March 19, 2016

The Web is (finally) a mature platform

Or, why MEAN will never be LAMP

I started my career as a “web developer” circa 2007. I’d dabbled before with Javascript while making sites in HTML/CSS as early as middle school, but that was my first real job as a real software developer. Back in those days, LAMP (Linux/Apache/MySQL/PHP) was about the only sensible way to build a web application. You could use Java servlets, of course, or build applications using CGI, but once PHP was stable and available and straightforward, and it quickly became the obvious choice for a huge range of applications.

I’m telling you this because the other day I stumbled across this question on Quora, from an old PHP/MySQL developer who was just coming back into the game, and wanted to know what the present state of the art was. There were a huge number of different responses (of which my answer was obviously the best), but one that as conspicuously repeated was the idea of the “MEAN” stack.

So why MEAN?

MEAN is a stack consisting of MongoDB for a datastore, Express.js for a backend framework, Angular.js for a frontend framework, and Node.js for a server/platform. It’s a perfectly fine technology stack, I’m sure, but to me it doesn’t seem so exceptional. After all, MongoDB has drivers for pretty much any language you would want to use, Express.js likewise has equivalents, and Angular doesn’t care a bit what language you use on the backend. Really, the whole effort just seems like a way to make Node.js development easier and/or more standardized, but it seems to have stuck for whatever reason.

So why MEAN? I feel that MEAN is a meme born of developers faced with a paradox of choice. There are so many popular, proven, and acceptable ways to build an application for the web now, each with its own set of tradeoffs but all fully applicable to the general case.

In the latest edition of their Web Framework Benchmarks, Techempower tested 162 frameworks, spread across 25 programming languages and running on 69 platforms. All of these are ways that people are really using to write web applications. It’s not like Express or Node is the most performant option (it does ok, tending to end up near the middle of the pack at around 10% of the most performant option) and it’s definitely not the most expressive (compare the express.js source to the flask, which tended to perform about as well).

For most projects starting out, before the true performance bottlenecks of the application are even close to understood, MEAN is just one of a veritable universe of perfectly fine choices. It stands out in exactly no dimension, save the number of blog posts (and quora answers, apparently) touting it as the next great thing. MEAN is the next acceptable thing. By the time your application is starting to experience problems, you should have the enough knowledge about the nature of your issues that you can make an educated choice of datastore/language/platform/application architecture.

Three years ago when I started at Tapstream, the product was entirely a Django/Postgres application. Now, the core is implemented in Java with Cassandra as a canonical datastore using a variety of big-data and web frameworks for different components, with a single-page (ha! it’s huge) Ember.js dashboard running against a Flask REST backend (although it still uses the same Postgres database as ever (ignoring the Ship-of-Theseus issues with this usage of “same”)). If your application lasts through 3 years of growth, I guarantee you’ll experience a similar transformation.

So what do I do?

If you must keep up with the joneses, in my opinion, this is the next big thing in web development. Otherwise, you should experiment with the myriad of options available and find something that works for you! The more things you try, the better the decision you’ll make when you actually have to make a decision based on real technical tradeoffs.

The choice is, and always will be, yours!