I loved this comment on Hacker News, especially the last paragraph which I’ll quote here:

The question implicit in your comment is: Could we design a system that offers the ease of accessibility of the first few steps of a PHP programmer’s career but, as one climbs the learning curve, eventually blossoms into Python or Ruby or even Lisp? I wish I knew. My best guess as of this morning is that a demigod could design such a system, but it’s very difficult for mortal humans to do so, because once you know how to program it’s hard to avoid overdesigning, putting in things that will eventually be useful in year two but are discouraging in year zero. We make terrible pedagogical mistakes, like turning everything into an object. (Does your ORM seem intuitive to you? That is why PHP is beating your system in the marketplace.)

28 thoughts on “PHP is crazy

  1. Out of interest, do you know any other languages yourself? I come from a PHP background and have slowly made the transition into Ruby – which has made me a much better PHP developer.

    I’ve often wondered what WordPress would look like rewritten in Ruby, or hell, even just rewritten from the ground up in modern PHP. Especially with the introduction of traits in 5.4.

    1. Hopefully to a user it’d look the same. Under the hood it’d be different, but not necessarily better or worse. In a previous life I wrote Perl for money, so I was fairly fluent in that, and I’m conversational in Python and Javascript. Of everything I’ve tried, I like Javascript the best, but it’s also probably my weakest.

      1. I share your hopes that it would look the same to the user; the backend has amazing design, polish and soul.

        However, I think given the chance to break backwards compatibility and rewrite from nil, you and your team would probably do a much better job on the internals. For example, It would be nice to have a cleaner separation of view and application logic.

        Agreed on the Javascript front – it’s a great, dynamic language, but feels a bit like the Wild West; there is no one “right way” to do anything.

    1. PHP vs. (Some Language) is like StarWars vs. StarTrek.

      Immature nerds care. Normal people (99.9% of clients) do not care.

      Trying to convince Picasso he shouldn’t use a sable brush is a waste of time.

    1. The comment is saying that PHP’s main advantage is that it maps well to the mental model of people who don’t know how to program yet, while still being flexible enough to scale up to run complex sites like WordPress.com and Facebook. The original article it was in response to was a fairly comprehensive list of all the things that are messy about PHP as a language.

      1. It mainly scales up for FB because the FB team wrote their own PHP compiler.

        Their compiler transforms PHP into compiled C++. The entire facebook site is a 1GB+ binary that gets served.

        This information is public knowledge. FB released a video a few months explaining it.

  2. Agreed.

    With many languages I never really left the “newb” programmer phase because I ran into too many things that stopped me cold and didn’t have a mentor to help me through when cash or clients were on the line.

    PHP and JavaScript are the first languages that I feel I’m somewhat beyond n00b mode.

    I think what it would look like – framework modules.

    Design me a framework (like Thematic) that has done the heavy lifting and allows me to gradually extend my knowledge, and I’ll learn how things like hooks and callbacks and conditional statements and the loop and responsive design works… make the next steps automatic. “You must learn how to create a widget area because these widget areas are not handy. You must learn how to design a template page because the existing ones don’t meet your needs.” And so on.

    But where to go from there? Another module, probably.

    The problem is – you’d have to pass up quite a bit of client work to build modules like that. The folks who know PHP inside and out might be willing to sacrifice the time if someone was footing the bill.

  3. I love PHP! Very easy to learn, yet incredibly powerful.
    Its easiness explains why there are so many developers contributing to great software like WordPress 🙂

  4. I think that’s where frameworks come in. From Zend Framework, Symfony, or even the PHP SPL, you get advanced features that “blossom” without complicating the root language.

    Even with Ruby… I’ve never actually met a Ruby developer, only Ruby on Rails developers which is analogous to a Symfony developer IMO.

    1. Yes, frameworks become your best friends when you know a little bit about what’s under the hood.
      I guess they also add constraints (or conventions) that make things harder to break, because they enforce good practices.
      Of course, everyone has a different idea of what constitutes a good practice.
      It’s all a delicate balance between ease of use, security, scalability, and design elegance (whatever that means to each individual developer)

  5. The key for everything sort of appeared with C. Since then, a huge number of languages have (more or less) adopted its syntax. It makes transitioning from one language to most others not all that crazy. Usually. It’s the function libraries that kill ya — they can be frightfully large.

    I still remember the true craziness I had using FORTRAN, COBOL, and Univac 1100 assembly at school; Pascal, Ada, and VAX-11 assembly at work; and 6502 assembly and C at home. In comparison, PHP…not so bad.

    It boils down to having/using the right tools for the job. For the web, PHP is a pretty darned good tool for programming.

    1. I agree :
      “The key for everything sort of appeared with C”
      C++, Java, Javascript, PHP have similarity syntax with C language.
      Anyone who mastering C language will easy to adopt PHP.

  6. I started coding in 1981 with Basic, then Pascal, then Cobol (+CICS+DB2), then Html, Javascript, CSS, PHP, jQuery …

  7. I’m at the other end of the scale: I started programming in 1971, in FORTRAN then I learned System/360 Assembler. I very much like PHP, mainly for its ability to make most things you’d ever want to do on the Web, possible in a relatively few lines of readable code.

    Arguments about what other languages WordPress could be written in forget one important detail: the low entry level bar that PHP represents for would-be programmers. That is extremely important because so much of what some many site owners do with WordPress involves modifying or writing PHP. Can you imagine having to write/modify WordPress customizations in C? Or VBA? I can’t.

  8. PHP drives me nuts.

    I cannot think of another open source programming language that is so bloated. Being both a software developer and a teacher, I could handle my students to build a software architecture in Ruby (without Rails) with only 6 sessions, something that can’t be done with PHP just because you need to stop and explain every feature, make them read the documentation on differences between strrev and str_split and why the language is inconsistent. PHP developers are crazy, yes… they should be in a psychiatrist, not in a room full of computers developing. Seriously.

    And don’t tell me that the learning curve is easy, because it “appears” to be easy. Python and Ruby are much easier to learn.

      1. Agreed, Ryan. PHP is very easy to “hack around” with, meaning to copy and paste bits of code and make it work somehow.
        But of course it gets messy once you try do things a bit more professionally.
        You have to do a lot of housekeeping.
        Maybe good PHP frameworks can help with that by introducing helpful constraints and conventions, as we discussed with Gabriel in his comment above.
        What do you think? Any preferred PHP framework?

  9. I’ll never understand why people feel the need to criticise another language. Certainly between PHP, Ruby and Python all the languages are great and have their own pros and cons. Its not like any of them are evil corporations trying to do the world a dis-service. They’re all open source and there’s enough room on the internet for all of them. Heck there’s even enough space to get a bit of C programming in.

    1. People just want to validate their choices, whether it’s a programming language (e.g.: Ruby vs PHP vs Python) or a brand (Ford vs Chevy, Canon vs Nikon, etc).

      If they chose Ruby, it’s because in their mind it’s better than PHP or Python, regardless of whether or not it’s true. To admit otherwise would be admitting that they were wrong to choose Ruby in the first place, and most people hate to admit that they’re wrong.

      I agree that the point is moot. They’re all programming languages, and what works for one person might not work for another, just as learning one language might be easier than learning another.

  10. Why is there an urge to pick a side? It’s in Humans’ Nature.

    Do the best tech-systems always win?
    – Betamax vs. VHS: technically Betamax had the better specs, VHS made it (then);
    – Vinyl vs. CD: from an audiophile perspective vinyl is better, yet the mainstream moved on to CD;
    – Windows vs. Linux: I won’t go there….

    It’s shows that it’s not obvious that the absolute best technology always come out as the winner.

    Open Source is systems are driven by community support. The ‘community’ in general have other priorities than the absolute best available technology.

    So: do we need to force creation of a new programming language? I think ‘No’. It will appear when necessary, driven by forces we can’t see yet.

    Evolution comes naturally, even when it’s about bits and bytes.

    //// my thoughts – peace out.

  11. During the development of my first and biggest PHP project (register.mu, since then re-written in Java), I came across all kinds of inconsistencies with PHP but once I had found solutions and worked around them, I just discarded them as features of the language.

    But, after reading the original post this comment was made at, I realised that my doubts about PHP were founded.

    These days, I don’t think it’s worth going with PHP when there are so many alternatives.

SHARE YOUR THOUGHTS