10 ms·
What does 'profoundly bad language' mean exactly? When PHP was first released it was dramatically better than the alternatives for it's intended purpose. Ther
by post_below 6y ago
What does 'profoundly bad language' mean exactly?
When PHP was first released it was dramatically better than the alternatives for it's intended purpose.
There were plenty of things to complain about, but none of them stopped you from doing useful things with it. It was never slow or inefficient compared to other scripting languages, it didn't lack functionality.
Over the decades the most popular complaints have been addressed as the language has matured.
That it's remained in active development for 25 years with no signs of that changing in the future is one of it's biggest selling points.
I don't blame people for having issues with aspects of PHP based on their personal preferences and experiences, I get that, but that doesn't make it a 'bad' language.
There's nothing wrong with purist perspectives on what programming languages should be and how they should work. That contributes to better design.
But in the real world the questions are simpler: can this tool be used to develop applications quickly? Is it reasonably efficient at runtime (in this case in the context of scripting)? Can we easily find affordable developers in the future? Is there community support?
PHP checks the boxes that people building things want checked as well as any language and better than many. Unless I'm missing something, 'bad' here is more of a philosophical stance.
- Zak 6y ago> When PHP was first released it was dramatically better than the alternatives for it's intended purpose. I think that's going to depend to some degree on how you define that purpose. If it centers around having a low barrier to entry, then that's partly true, but some of the ways it achieved that involved making code written in it vulnerable to variable poisoning and SQL injection by default.
- disgruntledphd2 6y agoDid Perl or C protect you against this when PHP came out?
- bawolff 6y agoWell register_globals was a kind of uniquely php thing, but that's been gone for ages at this point. I generally agree though that lots of the hate for php is a bit over the top.
- megous 6y agoAuto-escaping every GET/POST input at input time was quite something. Also arrays being pass by value is a lot of fun to this day: $a = [1]; $b = $a; $b[] = 3; var_export($a); And that you could pass by ref at call time to any function. That was also quite unique.
- Zak 6y agoCGI didn't have register_globals, so yes on that count. I'm sure the quality of database access libraries varied, which is still a better situation than having a broken escape function built in to the language.
- wbl 6y agoYes. Perl has had taint mode since 1994, and for setuid scripts for longer.
- MichaelBurge 6y agoFor SQL: On CPAN, the oldest release in 1995 of DBI does seem to support bind params. https://metacpan.org/source/TIMB/DBI-0.64/DBI.pm https://metacpan.org/source/TIMB/DBI-0.64/DBI.pm
- disgruntledphd2 6y agoThank you! I honestly didn't know (not paying attention to web programming back then) and was wondering if PHP's craziness was standard back then.
- egsmi 6y agoI think Bjarne Stroustrup put it best. “There are only two kinds of languages: the ones people complain about and the ones nobody uses.” The C++ Programming Language https://www.goodreads.com/quotes/226225-there-are-only-two-kinds-of-languages-the-ones-people https://www.goodreads.com/quotes/226225-there-are-only-two-k...
- blablabla123 6y agoI mean there are some quite uncontroversial languages. For instance Python. What surprises me the most, C is segfaulter #1 but literally nobody complains about that because it works good enough and the code is elegant. I think it still holds the position of most beloved systems programming language
- pansa2 6y agoPlenty of people complain about Python - about the language itself (significant whitespace, dynamic typing and excessive complexity), about the implementation (slow and limited by the GIL) and about the ecosystem (e.g. https://xkcd.com/1987/ https://xkcd.com/1987/).
- rovr138 6y agoPython 3 and unicode are some things people have complained about python for example.
- trhway 6y agoSegfalter is a feature which prevents release of weak code by weak people. Granted such approach isn't suitable in enterprise where Java rules because any kitchen sink of staff thrown together in Java still runs somehow, yet in systems you must meet orders of magnitude higher threshold.
- Aeolun 6y agoThe python way of doing ‘classes’ is pretty hideous to me. Why a self argument on every function?
- IgorPartola 6y agoBad type coercion you can’t turn off with weird semantics. Powerful but confusing arrays/dictionaries. Inconsistently named stdlib functions with inconsistent parameters. Little to no support for threading or concurrency models outside of making event loops or running multiple processes. Memory management that allowed for leaky memory all the time. Lack of proper support for stand-alone daemon processes (you could make it work but it was clearly not the main way PHP was meant to be run). Lack of namespaces or modules with all variables being global. This was PHP 5 and it sent me running for the hills (Python, ES6). I am sure PHP 8 is an improvement and I’ve worked with PHP versions past 5.3 but it left such a bad taste in my mouth that yes I will avoid it if I can. Fixing what shouldn’t have been broken may make this language almost as good as something like Python but why would I reach for PHP when better things exist unless that decision is not made by me?
- megous 6y agoNot sure what you mean about global variables. PHP 5 had the same scoping rules like it has now. You couldn't access global variables directly from anywhere but the toplevel execution context.
- IgorPartola 6y agoRight. So if file a.php has: <?php $MY_SOCKET_TIMEOUT = 5; And file b.php has: <?php require(‘a.php’); $MY_SOCKET_TIMEOUT = 10; That’s a problem. Same with every function and class name. Oh and requiring/including a file is not idempotent because it’s just string concatenation because they are not modules. None of that should be a part of a modern language. If they haven’t fixed that in PHP 8, then it’s still broken.
- Aeolun 6y agorequire_once has existed since PHP5 at least (when I started using it).
- IgorPartola 6y ago
- sergeykish 6y agoIt means bad design. It address claims like "PHP improved in last decade". I've checked and feel misguided. "Fractal of bad design" is still applicable strpos ( string $haystack , mixed $needle [, int $offset = 0 ] ) : int str_replace ( mixed $search , mixed $replace , mixed $subject [, int &$count ] ) : mixed It is not possible to use language without documentation, should name include underscore? Where to put string? I've switched to ruby, it is predictable. Mixed baggage of C, Perl, Java influences, no design. PHP 4 had design, PHP 5 made it total mess. Borne shell good in gluing UNIX tools, AWK good in simple columnar data, PHP good in one page scripts. You've described PHP as "useful" language.
- chrisweekly 6y ago"What does 'profoundly bad language' mean exactly?" My comment linked to a comprehensive answer to that question.