rc3.org

Strong opinions, weakly held

Life, the good parts

JavaScript: The Good Parts is one of my favorite computer books ever written, not just because it’s an excellent primer on JavaScript, but also because the title alone provides guidance to a way of living that’s worth pondering.

This week, PHP: a fractal of bad design is making the rounds. It’s a lengthy list of thoughtful criticism of PHP as a programming language (and Web development platform). The PHP core team should read it, although the truth is that most of the problems can’t be addressed without breaking old PHP applications, and the PHP folks are generally reluctant to make those kinds of changes. PHP has a massive installed base on shared hosting servers — breaking old applications reduces the adoption rate of new versions.

Here’s the deal, though. For all of the complaints about PHP, thousands of businesses rely on it, and millions of people use it with varying degrees of expertise. I personally have spent thousands of hours hacking on PHP applications, sometimes with much frustration. None of the problems listed in that blog post have prevented me from getting my work done in that time.

The secret to using PHP effectively is the same as it is for JavaScript … focus on the good parts. It turns out that works out for most everything in life. When I eat at a restaurant, I don’t have to like everything on the menu, there just has to be one dish that I enjoy. The number of bad dishes on the menu don’t really matter, what counts are the good dishes, at least if you willing to be an educated consumer.

We all choose the set of tradeoffs we’re willing to accept. I’m happy to take advantage of the opportunities working with PHP provides and do my best to stick to the good parts.

6 Comments

  1. I consider myself a terrible programmer.

    I can hack code if I need to but it’s not my job and I do it with reluctance.

    Reading this post and the one you link to made me realize that the available tools of the last 10 years make me a worst programmer than I should be – PHP and CSS.

    With better tools I think I could have been a better casual programmer.

  2. On the other hand, PHP is the shortest bridge from knowing absolutely nothing about programming to building something that works on the Web.

  3. Sadly, the only good part about PHP is that it “has a massive installed base on shared hosting servers”.

    To continue with your food-related analogy, Paul Ford recently put it nicely: “PHP is a programming language like scrapple is a meat”. http://nymag.com/daily/intel/2012/04/facebook-and-instagram-when-your-favorite-app-sells-out.html

    I will admit to enjoying scrapple, and it’s evil twin cousin from Cincinnati, goetta, from time to time. PHP less frequently.

  4. I am so tired of seasoned developers beating up on PHP, as if the rest of the world should give up whatever they’re doing and just become hardcore developers coding in C++, C# and Java. After all, the world runs on developers alone, right? 😉

    If PHP is such a terrible language, that even designers and non-programmers should avoid it (per the linked article, not Rafe’s comments), what should a non-developer like me do?

    I’ve tried using ASP.NET and C#, and Java, but past a certain point, the learning curve ramps up exponentially unless I dedicate myself to becoming a full time developer, which, to put it bluntly, is not an option for the vast majority of us using JavaScript, PHP and CSS in our work.

    So, what should we use? Ruby? Python? Give up? Or do as Rafe says, learn to use the good parts of PHP? Is there a “PHP: The Good Parts” book out there for the rest of us?

  5. I started out as a Perl programmer, but rapidly switched to PHP once it became available everywhere. Why? Reading other people’s code.

    In Perl (and most other programming languages), there are many different ways to code things: some will work(mostly), some will break with silent errors, some will work but won’t scale, and some are using so many shortcuts as to be incomprehensible. (Obfuscated Perl!)

    PHP reduces the amount of idiosyncratic code, and with a little formatting cleanup, allows me to work on just about anyone’s code. It also means that my code will easily be understood by the people who follow me.

  6. Being able to read other’s code is a function of the (original) programmer, not the language – but some languages make it easier than others. I’ve seen wonderfully written Perl (Perl being a language where you have to work to do it “well”) and horribly written Java (Java being a language that tries to force you to do it “well”). PHP has it’s own idiosyncrasies that are different, but not necessarily “better”.

Leave a Reply

Your email address will not be published.

*

© 2016 rc3.org

Theme by Anders NorenUp ↑