Beta
×

Welcome to the Slashdot Beta site -- learn more here. Use the link in the footer or click here to return to the Classic version of Slashdot.

Thank you!

Before you choose to head back to the Classic look of the site, we'd appreciate it if you share your thoughts on the Beta; your feedback is what drives our ongoing development.

Beta is different and we value you taking the time to try it out. Please take a look at the changes we've made in Beta and  learn more about it. Thanks for reading, and for making the site better!

The PHP Singularity

Soulskill posted more than 2 years ago | from the buggy-event-horizon dept.

Bug 622

An anonymous reader writes "Jeff Atwood at Coding Horror has a post about the awfulness of PHP — or, rather, a post about posts about the awfulness of PHP. He points out that PHP has been the whipping boy for the developer community for years, and while everybody seems happy to complain about it, nobody seems willing to do anything about it. He writes, 'From my perspective, the point of all these "PHP is broken" rants is not just to complain, but to help educate and potentially warn off new coders starting new codebases. Some fine, even historic work has been done in PHP despite the madness, unquestionably. But now we need to work together to fix what is broken. The best way to fix the PHP problem at this point is to make the alternatives so outstanding that the choice of the better hammer becomes obvious.'"

cancel ×

622 comments

Sorry! There are no comments related to the filter you selected.

Recursive? (5, Funny)

Anonymous Coward | more than 2 years ago | (#40495193)

And now, a post about a post about posts about the awfulness of PHP.

Which would make these comments posts about a post about a post about posts about the awfulness of PHP.

---
Recursion: First you curse, then you curse again.

Re:Recursive? (1)

Anonymous Coward | more than 2 years ago | (#40495461)

PHP itself is an acronym for PHP: Hypertext Preprocessor.. But then what does "PHP" stand for?

Don't give me turtles!

Re:Recursive? (5, Informative)

arth1 (260657) | more than 2 years ago | (#40495777)

PHP itself is an acronym for PHP: Hypertext Preprocessor.. But then what does "PHP" stand for?

It's an old joke, already trite by the time PHP came out.

GNU = GNU is Not Unix
Wine = Wine Is Not an Emulator
PNG = PNG is Not Gif (later backronymed to Portable Network Graphics)
LAME = LAME Ain't an MP3 Encoder
VISA = VISA International Service Association

Re:Recursive? (2)

ChunderDownunder (709234) | more than 2 years ago | (#40495853)

Don't give me turtles!

No, silly, ElePHPants.

It's always been obvious (4, Insightful)

Anonymous Coward | more than 2 years ago | (#40495765)

Python has *always* been obviously better than PHP (or perl, etc.) But if you have no skills, you look for the easiest path: the goal is to get the project going.

If your expertise is Perl, climbing the Python learning curve, gentle as it may be, isn't attractive, and becomes less so as your available time to engage in such things narrows. And so your project $sucks @terribly $$ and looks like APL But it works fine because you know how all that perl weirdness operates:


        $_ = shift;
        tr/+/ /;
        s/%(..)/pack('c', hex($1))/eg;
        return($_);

For a new user with no skills (which really seems to be the primary group that ends up using it), the availability of PHP examples and the ease of putting a canned site up seem to be the primary enticements. Slap a canned site up, and bam, there you are. *Now* you can learn how it works (which accounts of a lot of strange things on the web, but I digress.)

So better isn't really the issue. Easier is the bottom line, it seems to me. Where are the canned sites in Python? For that matter where are the canned sites in Perl or Ruby or whatever?

If "better" were all it took, no one would be running Windows, for instance, but that's not the case.

Mind you... *I'm* not running windows, and I long ago abandoned Perl for Python (and I'm so glad I did), but I'm someone who actually has the time to explore and make choices without someone else hovering over my shoulder or otherwise being compromised. I don't think that's very common.

Re:Recursive? (0)

Anonymous Coward | more than 2 years ago | (#40495805)

And now, a post about a post about posts about the awfulness of PHP.

Which would make these comments posts about a post about a post about posts about the awfulness of PHP.

---
Recursion: First you curse, then you curse again.

Love the comment, hate the article... although, I'd have the challenge how it's an article.

Really? (4, Insightful)

Anonymous Coward | more than 2 years ago | (#40495201)

What kind of bullshit logic is that? Something is broken, everyone hates it, so let's put all our efforts in making the alternatives better? How about contributing to PHP and fixing what you're bitching about instead of, well, bitching about it? You know, it's open-source and all.

Re:Really? (4, Insightful)

Anonymous Coward | more than 2 years ago | (#40495251)

The problem lies at its core [php.net] . You can't fix people.

Re:Really? (4, Insightful)

MightyMartian (840721) | more than 2 years ago | (#40495385)

Indeed. For years now it's been patiently explained over and over and over again what needs to be fixed, and the core team just keeps perpetuating the same crappy nonsense. Since there are other perfectly good languages out there, I see no point in anyone, say, forking PHP.

Re:Really? (0)

Anonymous Coward | more than 2 years ago | (#40495401)

Wow. Every time someone says PHP isn't that bad, I am going to send them that link.

Amazing.

Re:Really? (1)

Anonymous Coward | more than 2 years ago | (#40495547)

i read the whole bug and i'm not sure i understand your point.

person A was being paid to do a job. he failed to keep an eye on his job for a year whilst the RC was available. he then tried to get person B to fix things.

person B wasn't being paid at all, suggested a workaround, explained why it was too late to complain and was the creator of PHP... PHP being the language person A decided to build his company on.

what's the problem?

Re:Really? (-1)

Anonymous Coward | more than 2 years ago | (#40495709)

person B wasn't being paid at all

Which has fuck all to do with anthing, given how arrogant and dismissive they were of the issue. If a number formatter is supposed to default to 0, it's supposed to default to 0. Who the fuck thinks it's a good idea to return a null instead?

PHP is shit, always has been, always will be. Nice to know that the people behind it are also jackasses. They're certainly being paid an appropriate amount of money for it.

And people wonder why free software as an entity will never outrun commercial software.

Re:Really? (1)

ThePhilips (752041) | more than 2 years ago | (#40495597)

Fork?

Re:Really? (4, Insightful)

Java Pimp (98454) | more than 2 years ago | (#40495649)

I don't know. It looks like some guy has code that sends uninitialized or null values which to me would invoke undefined behavior and is then bitching about when that behavior changes.

From the thread: We are passing a (possibly uninitialized, or null-valued) variable to the function, in hundreds of places

Sounds to me like this guy has other issues he should be worrying about.

Re:Really? (5, Insightful)

Anonymous Coward | more than 2 years ago | (#40495659)

Poor example. Someone goes bananas when incorrect and inconsistant behaviour ( returning a number from a number formatting function when passed something that is not a number) is changed to correct behaviour consistent with the rest of php core (returning something that is not a number), after months of pre-releases and 'this is going to break buggy code' announcements, after everybody else has fixed their buggy code, and starts name calling, rather than:
a) fixing their own buggy code or
b) not upgrading the minor version on affected systems until their code is fixed

This looks like a problem with the submitter, not the PHP team.

Re:Really? (0)

tepples (727027) | more than 2 years ago | (#40495811)

So I gather the right way to do it is to upgrade the minor version and the buggy code at the same time. In that case, how does one upgrade the minor version without having to pay the early termination fee on one's contract with the web hosting provider? And how does one run applications that require different minor versions?

Re:Really? (5, Insightful)

jythie (914043) | more than 2 years ago | (#40495741)

Actually, I would put the fault on the complainer here....

Yeah, it sucks when languages and APIs change, but it happens and if one is going to be upgrading one should take such things as a given. This is why, when you have an environment where consistency is important, language and library upgrades are big deals that are scheduled with time allocated them.. otherwise freeze your versions unless there is a compelling reason with significant measurable benefit to upgrading... crow, I still keep VMs around in case I need to go back and work with earlier checkouts with known dependencies/versions.

Re:Really? (4, Insightful)

SolitaryMan (538416) | more than 2 years ago | (#40495847)

I honestly don't see how this demonstrates any problem with PHP people.

The guy was using some function in what appears to me as the wrong way (failed to validate inputs) and was relying on some edge-case behaviour. Now this edge-case behaviour has changed and made the mistake in his code more apparent.

I hate PHP and try to avoid it like plague, but this guy got what he was asking for.

Re:Really? (4, Informative)

Richard_at_work (517087) | more than 2 years ago | (#40495277)

PHP is well beyond fixing - mysql_escape_string and mysql_real_escape_string prove it, otherwise the first method would have been fixed rather than "replaced".

The best you can hope for these days is overlaying a framework.

Re:Really? (3, Informative)

JDG1980 (2438906) | more than 2 years ago | (#40495373)

PHP is well beyond fixing - mysql_escape_string and mysql_real_escape_string prove it, otherwise the first method would have been fixed rather than "replaced".

They had to do it this way for backward compatibility. If they changed the way it works, then any program that relied on the existing (buggy) behavior would break as a result.

Re:Really? (4, Insightful)

Richard_at_work (517087) | more than 2 years ago | (#40495441)

That's what major version bumps are for. Make it a breaking change, rather than make it something that festers in the codebase forever. If the method is broken, then the solution is not to let apps continue to use it.

Make it a breaking change, bump the major version up, force people to upgrade through obsolescence and we would be in a much better situation.

When multiple major versions aren't installed (1, Informative)

tepples (727027) | more than 2 years ago | (#40495535)

That's what major version bumps are for.

People will stick with the old major version if shared web hosting companies don't allow hosting customers to run an app for one version and an app for another version on the same hosting plan. Even outside PHP, that's one reason Python 3 isn't taking off as fast as was hoped: the operating system doesn't know which major version to execute when the user double-clicks a .py file.

Re:When multiple major versions aren't installed (1)

Richard_at_work (517087) | more than 2 years ago | (#40495913)

That's fine, if they want to stick with a fork which is buggy, insecure and unmaintained, I have no issues with that - just as maintaining an older PHP4 project became the bane of my life (having to switch from distro packages to my own build just so I could stay on a very old version of PHP), it's the pain which forces you to do something about it.

Coincidentally, my own experience supports my comment - there have been major breaking changes in PHP versions, and PHP has still moved on in adoption rates, so I don't think this would be an issue.

Re:Really? (0)

Anonymous Coward | more than 2 years ago | (#40495601)

And then you have people like this [slashdot.org] who complain when they make breaking changes between major versions. It's lose-lose.

Re:Really? (1)

SolitaryMan (538416) | more than 2 years ago | (#40495613)

The GP point still stands. Somehow other projects deal with this and nobody dies.

Re:Really? (0)

Anonymous Coward | more than 2 years ago | (#40495615)

And? Isn't it the job of the programmer to fix that? Like with pretty much any other API?

Re:Really? (1)

MightyMartian (840721) | more than 2 years ago | (#40495417)

Yup, apart from all the other absurdities, PHP's library just plain sucks. Inconsistent with loads of functionality duplication. I realize that a lot of this baggage is due to backwards compatibility, but the time has come to toss the cruft, come up with a new library.

Re:Really? (0)

Anonymous Coward | more than 2 years ago | (#40495493)

1999 called. They want their library collection back.

PDO has been standard in PHP for ages.

Same crap every time there's a post about MySQL or PHP. So-called "experts" stuck in 1999 (the year of the Linux desktop!) that can't change, or accept that something has changed.

Re:Really? (1)

Richard_at_work (517087) | more than 2 years ago | (#40495925)

PDO might be standard, but there is a huge install of legacy codebases out there which don't use it.

Re:Really? (-1)

Anonymous Coward | more than 2 years ago | (#40495555)

Your example of PHP being broken is about a depricated MySQL extension designed for PHP 4. Anyone that isn't a newbie is using either PDO or MySQLi. Maybe you should keep your comments to things you're actually an expert on instead of judging an entire language by the one wordpress blog you maintain.

Re:Really? (1)

knuthin (2255242) | more than 2 years ago | (#40495727)

I just wrote a reply to the parent, refreshed the page, and saw you had already mentioned "mysql_escape_string and mysql_real_escape_string". Looks like everyone hates it :P

Re:Really? (5, Interesting)

mfarah (231411) | more than 2 years ago | (#40495313)

What kind of bullshit logic is that? Something is broken, everyone hates it, so let's put all our efforts in making the alternatives better? How about contributing to PHP and fixing what you're bitching about instead of, well, bitching about it? You know, it's open-source and all.

An important part of fixing something is being able to recognize when it's better to throw it away and build it again. PHP has so many problems, in each layer down to the bottom, it's way past the "We can fix it if we apply ourselves": it's better to throw it away and build it again. Something like a new scripting language called PDR ("PHP Done Right").

Re:Really? (3, Insightful)

Richard_at_work (517087) | more than 2 years ago | (#40495499)

From what I've heard, that's pretty much what Facebook did - start off with PHP and eventually evolved their own language from it.

Re:Really? (2)

Ghostworks (991012) | more than 2 years ago | (#40495405)

What kind of bullshit logic is that? Something is broken, everyone hates it, so let's put all our efforts in making the alternatives better? How about contributing to PHP and fixing what you're bitching about instead of, well, bitching about it? You know, it's open-source and all.

The unspoken argument here is that the complainers are no longer trying to contribute to PHP by providing feedback. Rather, they have determined that PHP is fundamentally terrible at doing the work it's been recruited to do. Fixing it to be "the best possible wrong tool for the job" would not be productive.

Because it looks like it should work, you don't have the benefit of understanding that it doesn't until you've wasted your time using it and have probably committed a good deal of your project to it trying to make it work. Hence, most people using it today are less concerned with improving future iterations than they are with killing the damn thing by warning people away from it. Because if nobody uses it, nobody has to support it.

If this still sounds peculiar to you, remember this is pretty much exactly what happened to kick off the second browser wars. IE sucked, people complained constantly, Microsoft did nothing (because why would they?), and eventually enough talented people were fed up to get the old Mozilla code up to speed.

Re:Really? (4, Insightful)

Anonymous Coward | more than 2 years ago | (#40495427)

If I announce that I'm going to try to cross the Atlantic in an inflatable dinghy, there are two possible responses which a reasonable observer could have:

1. Tell me I am an idiot and going to kill myself, and to use a proper boat instead, of which many excellent designs are readily available.
2. Help me design and build the world's most awesome rubber dinghy, which, in the end, is still a rubber dinghy and still probably going to get me killed.

Re:Really? (5, Insightful)

billcopc (196330) | more than 2 years ago | (#40495527)

The problem with "fixing" PHP is it breaks compatibility with existing code. Not all of it, but a lot of it, because it was either written by complete imbeciles who just happened to get lucky, or brilliant coders who worked around PHP's perversions.

I'd like to think I fit in the latter category. I actually really like PHP because it's so dumb and open-ended, it lets me code whatever the hell I want without forcing much functional-programming hipster crap down my throat (I'm staring at you: Python/Ruby/Haskell/Scala/Clojure).

Yes, it's messy, and yes, it could greatly benefit from a concerted cleanup effort, but given it's install base and the mind-numbing amount of public code in use, it's hard to justify the pain in fixing all that stuff. Just think of the tens of millions of sites running some spinoff of PhpBB, the countless MediaWikis, nearly every torrent tracker, and all those pages of horrible code written by the aforementioned imbeciles. That's a lot of pain to satisfy a few pedants. Clearly, PHP works "well enough" for most of us.

That said, nothing's stopping people from forking it, fixing that code, and releasing it as something new. If it's better than PHP and helps me land paying work, or make my own projects easier to develop and maintain, I'll happily use it. Ah, but that would require these people to stop posting inflammatory linkbait on their canned Wordpress blogs and actually practice what they preach...

Re:Really? (3, Interesting)

beelsebob (529313) | more than 2 years ago | (#40495587)

Because no amount of polishing turd will make it into gold. PHP has some fundamentally wrong assumptions in its design, you can't fix it without just making it something that isn't PHP.

Re:Really? (1)

knuthin (2255242) | more than 2 years ago | (#40495681)

That would cause isolating the already established user base.

Like when you consider mysql_escape_string [php.net] vs mysql_real_escape_string [php.net]

Also camel case vs underscores in function names. I am no big fan of Java, but having consistency between class name cases and function name cases helps a lot, in a way that you can just "guess" a function name. If you change all of those right now, the already written PHP code will be such a big mess.

Though something like Python did with utility 2to3 could actually be used in the next PHP major release, but I suppose they are too cocky to bring about that change.

Re:Really? (2)

wkcole (644783) | more than 2 years ago | (#40495761)

Why contribute to a project that has such a solid record of recklessly incompetent leadership? Why work to prop up an ecosystem that has developed into a vast toxic swamp?

The advantages of PHP have always been reducible to the fact that it is relatively easy for non-programmers to understand. It's accessible for people who don't have a mindset for or interest in computer science. That's not inherently a bad thing, but it is risky. As with VB before it, it is true that any crazy idiot can code in PHP, so many of them do. The choices made over the years by many in the PHP community (led from the top) to keep it an easy, accessible, and forgiving platform in order to grow rather than improve the community have had predictable results. The debacle of the recent release bungles and the ongoing failure to either obviate Suhosin for 5.4.x or make it work is demonstrative evidence that the guiding spirit of the PHP universe is still one of reckless incompetence.

Re:Really? (1)

fluffythedestroyer (2586259) | more than 2 years ago | (#40495927)

I would get 100% troll post with what you just said... everyone hates me :(

Fixing PHP brokeness (1)

Ziest (143204) | more than 2 years ago | (#40495207)

Yeah, lets start by making PHP case sensitive.

Re:Fixing PHP brokeness (1)

wonkey_monkey (2592601) | more than 2 years ago | (#40495439)

Which particular bit that isn't are you thinking of?

Re:Fixing PHP brokeness (0)

Anonymous Coward | more than 2 years ago | (#40495539)

function and method names are not case sensitive.

People do something about it EVERY DAY. (0)

Anonymous Coward | more than 2 years ago | (#40495209)

[...] and while everybody seems happy to complain about it, nobody seems willing to do anything about it.

People do something about it EVERY DAY: they use something else.

PHP is brilliant (0)

Anonymous Coward | more than 2 years ago | (#40495221)

Rubbish - PHP is brilliant.

Re:PHP is brilliant (1)

LQ (188043) | more than 2 years ago | (#40495257)

Rubbish - PHP is brilliant.

I have to agree that for some small jobs, PHP is just the right tool.

Marketing Campaign! (0)

CriminalNerd (882826) | more than 2 years ago | (#40495241)

The best way to fix the PHP problem at this point is to make the alternatives so outstanding that the choice of the better hammer becomes obvious.

I think he's proposing that somebody starts a marketing campaign to trick/convince all the PHP developers to switch to something better because clearly, Outstanding = Great PR.

I hear that this Streisand guy does a great job of bringing things to the attention of the general public; he'd be perfect for the job.

Fix? I think you mean, "migrate" (1, Insightful)

betterunixthanunix (980855) | more than 2 years ago | (#40495245)

It is not as though there is no other choice. The only two things that need to be done are (a) stop writing new PHP code and (b) start migrating old PHP code to better languages. We can do web development in Python, Haskell, various Lisps, Scala, and several others. There is no "fixing" necessary, just phasing out -- and the only code related to PHP that needs to be written, if any, would be interfaces for better languages, so that old, impossible-to-rewrite code can be extended with something that is not PHP.

Re:Fix? I think you mean, "migrate" (3, Interesting)

JDG1980 (2438906) | more than 2 years ago | (#40495315)

It is not as though there is no other choice. The only two things that need to be done are (a) stop writing new PHP code and (b) start migrating old PHP code to better languages. We can do web development in Python, Haskell, various Lisps, Scala, and several others.

None of these languages use standard C-style syntax. That syntax is one of several reasons why PHP is so ubiquitous: any reasonably competent C/C++/Java programmer can adapt to it quickly.

Re:Fix? I think you mean, "migrate" (5, Insightful)

ewieling (90662) | more than 2 years ago | (#40495657)

The C-like syntax and wrappers for all sorts of handy stuff like POSIX threading, sockets, SSL, etc is why I like PHP. My biggest issue with PHP is that these functions are poorly documented (especially the SSL wrappers). I am not a language purist, I want something easy to use, gives me access to all the nifty stuff Unix can provide, and doesn't make me learn an entirely new syntax. If I was a professional programmer I might feel differently, but for MY needs at my job and for personal projects PHP is a good tool.

Re:Fix? I think you mean, "migrate" (1)

Daniel_Staal (609844) | more than 2 years ago | (#40495845)

That was just a short list. Others exist.

If you want people to come from C-style syntax, have you taken a look at Perl? ;)

if php is broken what is javascript? (4, Interesting)

Anonymous Coward | more than 2 years ago | (#40495255)

if php is broken what is javascript?

Re:if php is broken what is javascript? (3, Insightful)

Ziest (143204) | more than 2 years ago | (#40495333)

if php is broken what is javascript?

A disaster.

Re:if php is broken what is javascript? (0)

Anonymous Coward | more than 2 years ago | (#40495529)

Exactly.

Lua [lua.org] is better and has been around for ages. Very stable, simple, powerful, and faster than everything else (LuaJIT [luajit.org] is probably the fastest scripting language ever made).

Re:if php is broken what is javascript? (2, Funny)

Anonymous Coward | more than 2 years ago | (#40495515)

Client-side misery.

Re:if php is broken what is javascript? (1)

Anonymous Coward | more than 2 years ago | (#40495559)

A nice language with shitty syntax

Re:if php is broken what is javascript? (0)

Anonymous Coward | more than 2 years ago | (#40495561)

Malicious.

Slow down cowboy. You're capable of typing pithy replies faster than we ever conceived.

Re:if php is broken what is javascript? (1)

Anonymous Coward | more than 2 years ago | (#40495787)

>if php is broken what is javascript?

Slightly less broken, but infinitely less replaceable with something better. What alternative do we have for rich interfaces on the web?

and (3, Insightful)

Anonymous Coward | more than 2 years ago | (#40495291)

if one is happy with PHP and has still not encountered peculiar problems?

Re:and (0)

Anonymous Coward | more than 2 years ago | (#40495407)

Ignorance is bliss.

Re:and (1)

rev0lt (1950662) | more than 2 years ago | (#40495479)

You still haven't written any code. Keep reading that hello world tutorial. :D

Perhaps it is not broken and horrible (4, Insightful)

Anonymous Coward | more than 2 years ago | (#40495311)

PHP is a language for getting thing done. Just like any toolbox, you can build great or terrible things with it. It's like perl in that way (and I've done plenty of both). If you code well, there's very little to complain about with PHP. I've hired java guys onto my php projects before, and they were up and running in a week or so because we were coding with some structure instead of slapping together hacks.

And personally, I wouldn't want it any other way. I don't want language designers deciding they know what I want to do better than me. What I want, is the flexibility to build things as I see fit, and to do so quickly. Production is my goal. If you can help me build my projects elegantly/etc, then great, but getting it built quickly is always my priority.

Re:Perhaps it is not broken and horrible (1, Insightful)

MightyMartian (840721) | more than 2 years ago | (#40495465)

It's a broken tool that one has to put a considerable amount of effort into to write tolerably decent apps. It's libraries couldn't be worse than if someone took a print out of the specs, stuck dynamite in the middle and then tried to reassemble them. Coding in PHP has got to be one of the miserable experiences I have had, the only thing being worse is trying to fix someone else's PHP code.

Re:Perhaps it is not broken and horrible (3, Informative)

Anonymous Coward | more than 2 years ago | (#40495635)

PHP is a language for getting thing done. Just like any toolbox, you can build great or terrible things with it. It's like perl in that way (and I've done plenty of both). If you code well, there's very little to complain about with PHP.

I might be misinterpreting you here, but this sounds like a point responsed to in PHP: A Fractal of Bad Design [veekun.com] :-

Do not tell me that "good developers can write good code in any language", or bad developers blah blah. That doesn't mean anything. A good carpenter can drive in a nail with either a rock or a hammer, but how many carpenters do you see bashing stuff with rocks? Part of what makes a good developer is the ability to choose the tools that work best.

You also said:-

And personally, I wouldn't want it any other way. I don't want language designers deciding they know what I want to do better than me.

I also think the problem a lot of people have with PHP is its inconsistent and illogical bad design, which isn't the same thing as flexibility. I don't think having a logically designed language necessarily means one that forces its philosophy on you. I'll note that the fractal post referenced above also states that:-

I assert that the following qualities are important for making a language productive and useful, and PHP violates them with wild abandon. If you canâ(TM)t agree that these are crucial, well, I canâ(TM)t imagine how weâ(TM)ll ever agree on much.

* A language must be predictable. Itâ(TM)s a medium for expressing human ideas and having a computer execute them, so itâ(TM)s critical that a humanâ(TM)s understanding of a program actually be correct.

* A language must be consistent. Similar things should look similar, different things different. Knowing part of the language should aid in learning and understanding the rest.

* A language must be concise. New languages exist to reduce the boilerplate inherent in old languages. (We could all write machine code.) A language must thus strive to avoid introducing new boilerplate of its own.

* A language must be reliable. Languages are tools for solving problems; they should minimize any new problems they introduce. Any âoegotchasâ are massive distractions.

* A language must be debuggable. When something goes wrong, the programmer has to fix it, and we need all the help we can get.
 

(Apologies for the cut-and-paste splotches, but I don't have time to fix them right now)

Good things about PHP (-1)

hey (83763) | more than 2 years ago | (#40495349)

It lives in the browser so its fast.
It has a function for nearly everything.
Its syntax is mostly C-like

Re:Good things about PHP (0)

i kan reed (749298) | more than 2 years ago | (#40495433)

1. No it isn't
2. Not really
3. C is increasingly a bad structure for languages, as improvements come in

Re:Good things about PHP (3, Insightful)

wonkey_monkey (2592601) | more than 2 years ago | (#40495501)

In what way does it "live in the browser"?

Good programmer = good PHP code (4, Insightful)

Anonymous Coward | more than 2 years ago | (#40495359)

Any good programmer will be able to make awesome PHP code. Bad PHP written applications are just the result of lack of passion, knowledge, and in some cases don't forget it, pressure from the customer. Combine bad programming skills, no experience with other OOP languages, pressure and "I don't care how it is done, I've done it and it works that's enough"... and you get the result. I'm tired to read and hear that PHP is shit. -- ParaBug

Re:Good programmer = good PHP code (2)

hugortega (721079) | more than 2 years ago | (#40495483)

... and that's true for ANY other language. The main problem is about bad developers, not bad languages.

Re:Good programmer = good PHP code (0)

Anonymous Coward | more than 2 years ago | (#40495783)

Any good programmer will be able to make awesome PHP code.

And I'm sure the same good programmer will re-write awesome PHP code to replace the deprecated shit when an upgrade comes out...

a small and simple php script interpreter? (1)

staalmannen (1705340) | more than 2 years ago | (#40495369)

Is anyone aware of an alternative php interpreter that does not require tons of external dependecies? I have been playing with porting various stuff to less usual operating systems and PHP has definitely been one of the most dificult things I have undertaken. It requires quite a lot of other packages to first be ported.

Re:a small and simple php script interpreter? (1)

Richard_at_work (517087) | more than 2 years ago | (#40495567)

You could look at Facebooks HipHop tool, transforms PHP syntax into C/C++.

Re:a small and simple php script interpreter? (1)

rev0lt (1950662) | more than 2 years ago | (#40495577)

Well, most dependencies are module-related. You don't really need "modules" to build the basic interpreter. In fact, that is the way of doing things in FreeBSD (the PHP interpreter is standalone from all the modules, and each module is a separate port). Have a look at their ports tree and the supplied makefiles, it may give you some hints.
If the less usual operating systems you are porting to are unix-like, you may also try to use Pkgsrc (http://www.netbsd.org/docs/software/packages.html#platforms), a muti-platform ports tree.

PHP has only its members to blame (4, Interesting)

mlwmohawk (801821) | more than 2 years ago | (#40495397)

Years ago I was involved with PHP, and the core developers have no real interest in making anything better, or, more specifically, accepting any criticism. I'm not the only developer to be pissed off when decisions are made "off line" and passed down. There was no sense of community. In conversations with other would be contributors, the general consensus was the PHP was headed up by a bunch of pissy children.

Don't get me wrong, I think PHP is a powerful environment and a lot of things have been done with it, but it suffers from a lack of rigour. If they could decide *what* the hell the language wanted to be, that would be helpful. If they could clean up the extensions API that would be helpful too. PHP's extensions are so powerful but there is no abstraction, your extension is essentially a PHP internal module.

All in all, PHP has had power and potential for years, but the reason why ruby even had a shot was that the PHP project can't get its act together to address, or even acknowledge, its short comings.

PHP alternatives (5, Interesting)

Compaqt (1758360) | more than 2 years ago | (#40495413)

The one big redeeming feature of PHP is you set up a single DB server (or even multimaster) plus multiple webservers, and bam! You're sharing objects/sessions among the webservers. Doesn't matter what webserver the next request hits, the session's there.

By contrast, that simple thing is something that other environments struggle with. I remember ads for "Share Java POJOs" as if that was a huge deal, and the CEO of some firm that did that said people told him that was a godsend. I'd imagine it's the same for Python and Ruby.

1. Java. Huge memory footprint. Admins hate it because it doesn't conform to certain Unix conventions.

Try this: Download any one of a number of open-source Java CMSs or ERM systems. Then watch the Java exceptions flow down your console screen. Good luck figuring them out. Static analysis rules, except when it doesn't.

Java's great if you're writing an desktop app for geologists trying to find oil or a backend bank system. For your average, ho-hum, billion-dollar website: not so much.

2. Ruby: You go to war with the webserver they give you, not the one you want.

3. Python: Great language and library. A shame it was hobbled by the whitespace issue, which meant that some programmers didn't check it out who should have. Anyway, it's hard for Beta to get traction against VHS.

Anotherwords, PHP is good enough. "Worse is better. [wikipedia.org] "

Since the three environments above are monolithic, if there's a problem, it's a problem for every client logged in. PHP, by contrast, follows a Unix minimalist philosophy: if a PHP FCGI instance (or even an Apache mod_php instance) crashes, it's just that one instance. No problem, user hits F5, reloads, PHP's stateless, you get the session back, keep calm and carry on.

When Marc Zuckerberg or a number of other entrepreneurs started hacking out Facebook, they started out with PHP, just because it's light and fast, and easy to get something up on the wall. Nobody cares about the elegance of Python or Ruby, it's all about time to market.

Finally, nothing about "you can't debug PHP", in today's discussion, please. You can very well step through PHP code. Use Netbeans and something like xdebug. Or Eclipse.

PHP: Paraphrasing Churchill, it's bad, but the alternatives are worse.

Re:PHP alternatives (1)

Richard_at_work (517087) | more than 2 years ago | (#40495589)

Most languages can store session data out of process these days...

Re:PHP alternatives (3, Insightful)

codepunk (167897) | more than 2 years ago | (#40495687)

The biggest problem I have with python is that it spoils me. Writing python for a couple of weeks then having to jump back into a C syntax language causes me pain. It takes a few days again to get over the fact that I am constantly having to type cruft just so the compiler knows what I mean.

Re:PHP alternatives (2)

phantomfive (622387) | more than 2 years ago | (#40495895)

I think you've basically made his point. PHP is painful, but it sticks around because of the difficulties in the alternatives.

He is trying to say that improving the alternatives is easier than fixing PHP.

Hipsters (-1)

Anonymous Coward | more than 2 years ago | (#40495419)

Use ASP then, you picky bastards!

Yawn. (0)

Anonymous Coward | more than 2 years ago | (#40495425)

The article is completely devoid of anything original, useful, interesting or information. It's just a collection of links of previous rantings but with boring metaphors and analogies.

Lua (1)

Skapare (16644) | more than 2 years ago | (#40495455)

... FTW! \o/

Thats it! I am leaving (5, Funny)

Billly Gates (198444) | more than 2 years ago | (#40495525)

Going to Perl where I can get a simple concise syntax that is always the same among different programmers and does not have any idiosyncracies and enforced consitancy everywhere.

Re:Thats it! I am leaving (2)

ParaBug (2673543) | more than 2 years ago | (#40495789)

Switching to Perl would be perfect in a single developer environment. I could reuse a lot of my work. The problem is that with almost all the teams I have worked with, either as an internal or as a consultant, the only person speaking fluently Perl was me. I would appreciate to hear what others have experienced (and I'm even willing to relocate ;) ) if I'm wrong. In web agencies, newly graduated and 2-5 years experienced developers mostly do not know Perl and are not even interested in it. I had more chance with IT guys, or anyone really working with *nix systems (not 5 minute Ubuntu install clowns). Maybe Ruby On Rails would be a better alternative to get more additional team members interested?

Major Flaw in PHP versus Perl (1)

ambidextroustech (2597091) | more than 2 years ago | (#40495533)

Although this complaint is merely a cry for PHP to receive fixes in its code, I have read on the web that a major issue with PHP has to relate to hashes. According to LWN.net [lwn.net] , a denial of service can occur when the hash functions are put into excess which will cause the system to become unresponsive and cause denial of service.

Yes, I do agree with my peers. The largest benefit to PHP is its C-like syntax, and TIOBE.com [tiobe.com] lists C as the top language followed closely by Java, C++ and then Objective-C, which is C with Smalltalk.

Lousy Developers (2)

KalvinB (205500) | more than 2 years ago | (#40495541)

If PHP were as awful as the author claims, "Some fine, even historic work has been done in PHP" would not be possible.

Coders without the most basic grasp of object oriented designed, initial variable initialization, white-space use, code flow, etc are the problem. Languages that try to force coders to not be retarded are not the answer. It's very easy to spot coders you should never hire if they use a language that lets them reveal their ignorance and lack of organization skills.

It's far easier to modernize code while maintaining the same core language than it is to completely start from scratch with a new language.

While PHP's OO functionality is pretty lousy up until 5.3 when it finally got late static binding, it is perfectly sufficient and no excuse for crappy spaghetti code.

Re:Lousy Developers (2)

MightyMartian (840721) | more than 2 years ago | (#40495605)

Millions of lines of fine, historic code were written in COBOL, but I don't exactly here anyone declaring it a wondrous language.

Re:Lousy Developers (3, Insightful)

edremy (36408) | more than 2 years ago | (#40495935)

It was a wonderous language. It was (for the time) very easy to use, powerful and understandable. Millions of lines of code were written in it because it *worked*.

Fortran's pretty similar- nobody here is going to hold it up as a language marvel, but it was- it fit the niche of "powerful number processor" very well. Perl is noted for being a complete mess, but if you need a quick script to massage some text nothing is better. BASIC fit into its niche as well, and frankly so does PHP

None of them were "elegant" in the sense of LISP, Smalltalk or Haskell. How are those doing by the way?

Cheap web hosting with SSL and non-PHP? (-1, Flamebait)

tepples (727027) | more than 2 years ago | (#40495581)

This web host [securepaynet.net] offers PHP for $5.95 per month or Perl, Ruby, or Python for twice that. It's too bad because otherwise, they appear to be one of the least expensive entry-level hosting services that supports SSL. (Without SSL, your users can get Firesheeped.)

PHP: The next COBOL (1)

Anonymous Coward | more than 2 years ago | (#40495603)

Am I the only one that's already starting to see similarities between PHP and COBOL? Both languages are designed for "non programmers". Both languages have a multitude of projects written in them.. and I suspect in 30 years, some of those web applications will still be running on "legacy" x86 hardware rather than ARM or whatever we'll all be running then and every young programmer will be complaining on their blogs or whatever about how bad of a language PHP is and why anyone ever made any project in it.

Hear Hear (0)

Anonymous Coward | more than 2 years ago | (#40495627)

Dead on. As an old PHP user I'd go further and say PHP's story is a cautionary tail for all those "alternatives". PHP is open source but really controlled by Zend. To wrench that control away from them would not be worth the effort.

Ruby and Rails (what I use currently) are just this side of out of control. Assembling a stack that works (an often unique collection of Gems, Ruby, and Rails versions) is touchy and when you get one that works you don't want to futz with it much. So the community has created ways to lock down everything and swap out whole dev environments when you work on different projects.

This is a little understood problem with OSS. Either the contoling party is asleep at the wheel or it is community controlled and tetering on the verge of chaos. Always look at control and community before picking an alternative.

Source of PHP programmers (5, Insightful)

EmperorOfCanada (1332175) | more than 2 years ago | (#40495639)

I would be less quick to blame PHP than blame the fact that many PHP programmers come from "Web" developers. People who started with MS Paint and some HTML, then some CSS and then jammed in some PHP. After a while they got pretty good at small PHP 50 line programs. But when faced with huge projects people like this just aren't prepared. A great programmer could use PHP just as well as any other language.

But the second half is that PHP should be bad at times. Often a simple unstructured script is the best. It needs to do a simple thing quickly and well. There is no need for templating, language abstraction, unit testing, separation of data, logic, and view. So if you are a bank deploying a mission critical system then it should be rigorous and perfect. But if your blog about car tires needs a widget that reads from your odometer then hack away.

I would say that all arguments that condemn PHP should whither under the light that Facebook was developed primarily in PHP with MySQL. Even now they have their Hip Hop that converts PHP to C++. Arguing against PHP is like saying that Carbon Fiber is a better material than steel for car frames. Absolutely true but most cars are still successfully made from steel for a wide variety of reasons. Next time I need to win an F1 challenge and it had better be Carbon Fiber. But for the next ride to the grocery store and I just don't care.
So to circle around one could argue that the best cars are made from this or that but the reality is that what made the truly terrible cars terrible was that the designer would have made a terrible car out of anything. So teach a "better" language to the people making messes with PHP and you will just have a different kind of mess.

Missing the forest for the trees (5, Insightful)

Angst Badger (8636) | more than 2 years ago | (#40495647)

I've programmed in every major language and several minor ones from the 1970's to the present day, never mind design methodologies. They all have their relative strengths and weaknesses, but at the end of the day, the only thing that really recommends one over the other is a) what's available, and b) what you're most familiar with. No widely used language is "broken" any more than any natural spoken language is broken. No one ever says, hey, this novel would be much easier to write if we were taking advantage of the greater expressive power of Indonesian instead of kludgy old Lithuanian.

Aside from juvenile cliquishness and fashion obsession, every language flamefest starts with people obsessing on some awkward feature of the dominant language du jour, and then concluding that all of their problems would be solved if we all switched to some other language without that awkward feature. Of course, tomorrow's language (or methodology, editor, coding standard, platform) has its own awkward qualities that will only become apparent once it collides with the real world on a large scale, setting the stage for the day after tomorrow's language. Rarely does anyone pull their head out of their compiler/interpreter long enough to recognize that it's the real world that's awkward, and no amount of switching between fundamentally equivalent machine-parseable languages is going to change that.

Instead, we keep implementing the same stuff over and over in one language after another until the pace of real progress slows so much that we can actually get excited that the document viewer we're trying to port everything over to is receiving a "major" new features in HTML5 that will allow it to get a little closer to matching the desktop GUI functionality of twenty years ago, only not as well and with the added requirement of several orders of magnitude more hardware power required to keep it going.

But by all means, let's get rid of PHP if that makes it easier to imagine that we're doing something besides reinventing the same old wheel and doing it badly.

Languages don't make bad code, programmers do (5, Insightful)

melonman (608440) | more than 2 years ago | (#40495695)

The assumption in TFA seems to be that PHP does something that couldn't be done otherwise now, or does it more easily, or something. But I don't think that's true. There are alternative languages and alternative ecosystems now. IMO, most PHP coders don't use PHP because they have looked at the alternatives and decided PHP is the best choice, or the least bad choice, or any other choice. People use PHP because either

1: It was forced upon them for some reason or

2: It was the first thing they found and it was good enough

If that's the case, it's irrelevant how fantastic the alternatives are.

Also, while PHP code can be truly terrible, people who are determined to write terrible code will do so whatever the tool. You can use almost anything as a hammer if you try hard enough. The myth that The One Right Language somehow makes bad programmers good is still alive, especially within the Python community, but it's stll a myth.

When good programmers have no choice but to use PHP, they'll find a way to build something that is workmanlike even if it isn't beautiful. When bad programmers program, the result is going to be bad regardless of the language.

Re:Languages don't make bad code, programmers do (1)

Anonymous Coward | more than 2 years ago | (#40495911)

Languages *do* matter - there's a reason there are very few (if any?) websites written in pure C. There are a certain set of problems that have to be addressed for any programming project, and using a language (and environment - libraries, etc.) where you can concisely and clearly express robust solutions to those problems is a huge advantage. It's easy to write bad code in any language, but there are (problem,language) pairs which make it virtually impossible to write good code.

The problem is somewhere behind that cloud (1)

gmuslera (3436) | more than 2 years ago | (#40495733)

... or maybe is all the cloud the problem. Maybe isnt just the language itself the problem, also the culture behind it, people that did it, that contributed to it, tools all around that helped or damaged it, and, of course, the ones that try to use it as a normal hammer instead of the double-clawed hammer that it is. Changing the language alone won't change the other factors, and a in a used enough language you don't take a photo, you get a whole process where all the factors take part, a full ecoystem is behind. i.e. take another language, like python o ruby, and try to put the same ecosystem behind it, fullfill the same requirements, with the same people, probably would get to the same place.

What are the alternatives? A closed/comitee ecosystem? Strong approval policies to accept contributions? Maybe some of the good things of PHP came because is not that way.

You can always take your prefered language, and build around it most of the tools/libraries/etc that made php popular, with as much points of common as possible, but with the bad parts (for some definition of bad) out. But there is more than just code what will make it succeed or not.

All Code will eventually be "Awful". Stop Whining! (1)

ClassicASP (1791116) | more than 2 years ago | (#40495849)

I'm primarily a Classic ASP specialist, and for years I've been hearing in blogs and tweets about how awful Classic ASP is. And now I've started doing a serious amount of PHP work professionally, here we go again with the moaning and groaning of how awful PHP is. I refuse to call the _language_itself_ awful just because I encountered frustrations when working on someone's website. Instead I place the blame on the original developer because they did things such as:

- keeping their code really sloppy and unreadable
- not leaving comments explaining what the code does
- using ambiguous variable names that don't have any relevance at all to their purpose
- poorly named functions and classes
- jamming 7000+ lines of code into a single database stored procedure (with similar problems as described above)
- hardcoding things that should have been database driven with an administrative control panel
- OVERKILL on object oriented coding, thus sending you all over the damn place to fix something that could have been much shorter and simpler
- too many layers of technologies working together to accomplish something simple, so to fix, you have to read an page which uses a DLL, which calls a stored procedure, which queries a view, which queries another view, which queries another view, which queries a table, which triggers a......

This kinda stuff can happen in any language, and in time, you'll find another language to complain about. 5 or 10 years from now you'll be touting that Java sucks! Don't hate the code. Hate the coder who fled the scene of the incident and left you with a mess to deal with.

PHP (1)

Anonymous Coward | more than 2 years ago | (#40495877)

All languages (linguistic, programming, etc) suck for one reason or another. Trying to impose order or ideological structure on something that's inherently chaotic and entropic in nature misses the point -- languages exist to bridge gaps, and if a double-claw hammer is needed by some crazy loon for something, then one will be made -- look at the conjugations of the verb "to be" as a spoken language equivalent. Meaning and order change and deteriorate over time to suite the gaps of the day that need to be bridged.

Which brings us to PHP. Yes, it's a mess. However, it's a highly functional, easy to implement, powerful mess that a good programmer can write the code equivalent of Shakespeare with. So, instead of trying to solve a problem that doesn't exist if you don't have Autism, how about doing something useful like streamlining javaScript?

HUH? (1)

willy everlearn (82796) | more than 2 years ago | (#40495921)

Love PHP. The list of successful php deployments is huge.

Load More Comments
Slashdot Login

Need an Account?

Forgot your password?

Submission Text Formatting Tips

We support a small subset of HTML, namely these tags:

  • b
  • i
  • p
  • br
  • a
  • ol
  • ul
  • li
  • dl
  • dt
  • dd
  • em
  • strong
  • tt
  • blockquote
  • div
  • quote
  • ecode

"ecode" can be used for code snippets, for example:

<ecode>    while(1) { do_something(); } </ecode>