Apples, Oranges, and Web Developer Tools

I came across an article titled “PHP vs. Node.js: An epic battle for developer mindshare” and articles like that bug me.  I like that they are talking about developer mindshare, because mindshare can really impact the quality of tools and end results from a given platform.  But posts like “this tool is better than that” don’t help developers choose the right tools for the right job, or help clients understand the big picture.  So I thought I’d share my take on the topic.

PHP came out in the mid-1990s, as did the JavaScript language, upon which Node.js is built.  Node is only a few years old, but it’s still fundamentally JavaScript on the server.  Both tools are about 20 years old, but have radically different histories- in part because they were built to solve different problems.  20 years is a very long time in computing, and the problems PHP and JavaScript were built to solve have changed, a lot.

The Mainframe is Dead

Back in the bad old days of computing, computers were so expensive that it made sense to have one really big computer with many “dumb” terminals.  The big computer, the mainframe, did almost all the work.  When personal computers and the internet started becoming widespread, it shook that model to the core, and PHP was part of that vanguard.  Suddenly users were sitting at powerful workstations instead of dumb terminals, and the role of the mainframe became one of dishing out content (called HTML) instead of the entire application.  The web browser was the application, and PHP was a great tool to deliver content to it.

Of course a whole host of other languages and platforms evolved to compete in the content-delivery space: Active Server Pages, Java Server Pages, CGI, Cold Fusion, to name a few.  JavaScript appeared at about the same time, and it was a bolt-on feature to the Netscape browser.  It’s job was not content delivery though: it was designed to add interactivity to the delivered content- animations, button clicks, image preloaders…  in the grand scheme of things these were parlor tricks compared to the stuff happening back on the server.

Why it Doesn’t Matter

Every language sucks.  Except when it is used for its intended purpose.  Comparing tools designed to do different jobs doesn’t help anyone- and Node.js isn’t designed to shuttle HTML content from the server to the web browser.  It can; quite well in fact.  But that’s not what it’s good for.  Node was written to be a lightweight network services tool.  It was conceived for fast processing of discrete network messages.  The reason it gets lumped in with web development technologies is because that’s basically what a web server does.  It’s just that Node is so much more than a web server.

Node can serve up HTML, or it can serve up data, or provide an API for managing a network or data center.  It can scrape websites or process files… it’s a nice tool for doing behind-the scenes work.  All that is to say: it’s not a direct competitor to PHP.

I’ve written about using Node as a development tool, and using the power of its built-in package manager, build tools, and automation strategies.  I’ve also written about how JavaScript is really taking center stage as a development tool these days.  I really like JavaScript, so I’m biased.

But I can also say that I really like PHP.  It’s given us amazing tools which set the bar high, like WordPress, Drupal, and countless others.  There aren’t any Node.js content management systems that hold a candle to the venerable stable that PHP boasts.

And that’s completely ok, for both languages.

The Web of Tomorrow

Just as the World Wide Web disrupted the mainframe computing model, modern web apps are changing the way people use computers, and by necessity, the tools that power them.  These days people surf the web with phones, watches, even refrigerators.  PHP has been (and still is) a wonderful tool for conventional websites.  But more and more sophisticated web apps demand newer and more specialized tools.  For instance, single-page-apps don’t consume HTML files, but raw data from an API.  PHP can provide that API, and quite well, but that’s not really what it was designed to do.  Node on the other hand, was designed for just that.

So when you read an article proclaiming the superiority of one language or platform, remember: you can’t compare apples and oranges.

Submit a Comment

Your email address will not be published. Required fields are marked *