Want to read Slashdot from your mobile device? Point it at m.slashdot.org and keep reading!

 



Forgot your password?
typodupeerror
Bug PHP Programming

The PHP Singularity 622

Posted by Soulskill
from the buggy-event-horizon dept.
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.'"
This discussion has been archived. No new comments can be posted.

The PHP Singularity

Comments Filter:
  • by Anonymous Coward on Friday June 29, 2012 @11:24AM (#40495255)

    if php is broken what is javascript?

  • Re:Really? (Score:5, Interesting)

    by mfarah (231411) <miguel.farah@cl> on Friday June 29, 2012 @11:27AM (#40495313) Homepage

    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").

  • by JDG1980 (2438906) on Friday June 29, 2012 @11:28AM (#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.

  • by mlwmohawk (801821) on Friday June 29, 2012 @11:34AM (#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 (Score:5, Interesting)

    by Compaqt (1758360) on Friday June 29, 2012 @11:35AM (#40495413) Homepage

    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:Really? (Score:4, Interesting)

    by beelsebob (529313) on Friday June 29, 2012 @11:46AM (#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.

  • by gbjbaanb (229885) on Friday June 29, 2012 @12:49PM (#40496605)

    so PHP is like English with its mess of irregular verbs and pronouns. I guess the 'best' language is Smalltalk... the Latin of the computing world.

  • by VGPowerlord (621254) on Friday June 29, 2012 @12:57PM (#40496713)

    if php is broken what is javascript?

    If you've ever played Secret of Monkey Island, look at the poster of the woman near the bar.

    "When there's only one candidate, there's only one choice."

  • Re:I am a PHP user (Score:4, Interesting)

    by DrVomact (726065) on Friday June 29, 2012 @02:05PM (#40497667) Journal

    I am one of those "stupid" PHP users. It's not the first language I learned, nor is it the last. I'm well aware of Python as an alternative for developing web apps, and I've tried it, but I really do prefer PHP.

    One reason is flexibility in flow control. PHP has do ... while loops. Also, I can do "continue 2" or "break 2" if there is a loop within a loop, to continue or break at the outer loop. I'm honestly puzzled that Python still hasn't added these obvious and useful things.

    I've asked Python types about this, and gotten reasons like "you shouldn't be doing that in the first place," which pisses me off and makes me want to stick with PHP even more.

    I'm going to tell you what you don't want to hear, and I'm going to tell you because it's true: you shouldn't be doing that. The reasons why you shouldn't be doing that have nothing to do with any one programming language, they are general to all programming languages. They are the same as the reasons why you shouldn't have GOTO statements, and these things were learned near the very beginnings of the study of programming as a discipline.

    There are far too many people who equate the invention of new programming language with "progress". It ain't so. That being said, it's probably possible for a good programmer to write good code in any language. (I say "probably" because I don't know all the languages, including PHP.) However, not all programmers are equally good, so it might be wise to stick to languages that won't let you commit atrocities.

  • by Anonymous Coward on Friday June 29, 2012 @02:50PM (#40498297)

    PHP is a garden of paradise compared to Java, which has three or four thread models (Android has another couple), at least four layers of I/O (original streams, better streams, and two NIOs), multiple GUIs (AWT, Swing, and all the third pary stuff which fixes Swing's glaring deficiencies that make it useless), and so on. Not to mention the steaming pile of web overengineering which includes JSP, JSTL, EL, and so on as part of J2EE, plus all the third party stuff like Struts and Hibernate. Struts has two incompatible versions (one works with Java Faces, which is like an overengineered JSP) and Hibernate changes all the time. If you like MVC, I have lost count of the MVCs available. If you just want to overengineer for the heck of it, you can use Spring AND Hibernate at the same time. It's like wearing a belt AND suspenders.

    Compared to this, PHP is a sane and rational alternative for web developers.

The sooner all the animals are extinct, the sooner we'll find their money. - Ed Bluestone

Working...