Why Single Page JavaScript Frameworks are a Failure

Not long ago many single page application (SPA) frameworks started to appear in the JavaScript camp. Amongst them -- Angular.js, Ember.js, Meteor.js

It seemed understandable, the browser is so accessible. JavaScript can load remote content via Ajax. Why not have a single webpage, which in turn can load and execute remotes, in an MVC fashion. Great idea, isn't it. Well it seem not, and here is why:

1. Memory Issues

The client program--in this case the browser--excels in bringing the data in, doing some small tasks with it, and displaying it to the user. This is what browsers are optimized for. And for those, which do not remember it, it took about 20 years, for this experience to become almost unnoticeable to the user.

The SPA approach, as I see it, wants to change this. Instead of small task, It has the ambition to turn the single window if the browser, into a whole program by itself. Pros cited are as always--its faster, its more user friendly, easier to program.

However, this poses a great challenge. When you load a new page, the browser initializes the new page with a dedicated memory pocket, allocated to this webpage only. Each new reload, frees the consumed pocket, and the new page gets a free memory pocket again. With SPAs though, this memory pocket just does not free up. You load lots of resources initially, in order for all the SPA approach to be viable, so the initial memory pocket is already diminished. Most of the SPA pages are minimal--load a bunch of text, show it in a div. However, lots of them desire to be more sophisticated, requiring developers to manage data on the client side. This is where most of the issues occur. SPAs start to eat more and more memory, with each new feature, until they become the mastodons they are.

No matter how good the engineers are. How minimized the JavaScript libraries are, SPAs are doomed to fail.

2. Single Point Application, Means Single Point of Failure.

Another very underestimated point is that JavaScript is quite fragile on the client side. Multiple browsers, multiple JavaScript engines, various JavaScript versions, different features. Just because you application works on Firefox, does not mean it will automatically work on Chrome. How many times I was bitten, by being greeted by an empty page, just to find out the corresponding feature was implemented little differently on another browsers. Too many times. To top it all, in its current implementation, once the script throws an exception, it stops the rest of executing, rendering the whole page useless.

With SPAs, this chance increases. One exception, and the whole SPA dies miserably. Like an over burnt athlete, pushing too hard without a rest. being aware of this issue, TDD advocates ares quite strong among the JavaScript camp. And the reason is, if an exception is thrown, all this air balloon, is gone with the wind.

3. Navigation Using # . Gross Misconduct

Most SPAs use # or #! slugs to navigate their content. Well this is a improper use of the # sign. # is used for anchors, and this is it. No second opinion allowed. This is a gross misconduct, a terrible hack. Much similar to how viruses misuse your trust, and infect your computer, without being allowed to. If you are into SPAs framework development, do not use # for navigation. There are proper ways. Find them, and follow the specs.

3. JavaScript is Required

Minor point only, but still. Well I still remember the time, my web application had to work without JavaScript. You turn off JavaScript, develop the web page, test it, and only then you enhance it with JavaScript. Why would anyone turn their JavaScript off? Not the right question here. The browser resides on the client computer, which means you have no control over it. Its up to the user, or in a corporate environment the system administrator, what features will be available or not. Many users do not have a say. The bottom line is, do not accept for granted JavaScript works all the time, anywhere,


Every developer, myself included, has indulged the idea of building something a bit more useful putting his JavaScript skills at use. This most often happens right after, you learn Ajax, and you see its quite easy to load a text into a div. It feels great. But being easy to start with, does not always mean its the right approach. Think it over. Then use your critical thinking. Then use your common sense. Then ask your self this question "Can I do it without SPA?". If you answer is that you can, skip SPAs.