Refactoring development

Ramblings from the trenches...

View on GitHub
10 January 2016

Universal Javascript


Universal JavaScript

People laughed when I told them that the future of the enterprise is JavaScript. I told them it’s inevitable…and with ES6 ratified we’re one step closer.


They perceive JavaScript circa 1990s performance, with rough edges and a text editor as an IDE. It’s a world away from the truth now, with the raw speed of asm.js at the cutting edge, and standard JavaScript performance is ’good enough’ (almost every Java hotspot technique has been ported across to the JavaScript VMs). In 90% of business cases it’s not performance that’s stopping JavaScript.

JavaScript is a platform, not just a language.

And it’s only going to get better. Speed up Java or .Net and it helps a bit, but speed up JavaScript and you’ve just added a fraction onto the world’s GDP. There’s far more money backing speeding up JavaScript than anything else. (Remember JavaScript is a platform, not just a language.)

Check out the new WebAssemby movement (backed by all the right people) we might have a way to gradually migrate towards Javascript as a Platform.

Latest news on WebAssembly front - they’re getting there.

JS @ Front

The days of fat clients and WinForms/WPF are largely over. There’s little justification for not going HTML5 in a business setting. The UI I think we’re all agreed is going to be HTML and JavaScript for the foreseeable future.

JS @ Back

While Java and .NET back ends (and even some C++) will be around indefinitely, they are going to have to roll over and let JavaScript take its fare share of the bed. It started with Node.JS getting the ball rolling, but I’m sure there will be many other server side JavaScript platforms (it’s great to see io.js is going to merge back with node.js soon). We hope they will learn from the lessons and pain Java went through with J2EE.


The days of textpad are numbered. JavaScript has almost as good IDEs as the static languages have thanks to Chrome’s developer tools and JetBrain’s excellent WebStorm. Add in a little Karma and you’ve got a TDD platform that’s arguably better than today’s C# can manage.

But there’s more - Chrome’s next step in DevTools development is to allow you to use the Chrome devtools to debug both the client and the server from the comfort of your browser. This should lead to a very compelling and tight development loop. Read more about the Chrome Dev tools plans.

And it’s only going to get better.

The Future

JavaScript’s not a static language, it’s dynamic and evolving at a good pace. One thing that’s clear to me is that the future is definitely typed - with ES6 approved, the next big leap for the language in ES7 is giving people the option to type. FaceBook, Google and Microsoft are all rallying around definitely typed as a standard, and with those backers I wouldn’t want to bet against it.

Round up

All this JavaScript on the server - is it such a bad thing? Having one language on the client and server is an advantage. But it doesn’t stop there, JavaScript’s async nature means that it’s tilted in the direction of large parallel processing, and at its heart it’s a functional language (though a far cry from Haskall) with not too many bells and whistles.

Whether you think it’s a great or a terrible idea, as sure as eggs is eggs we’re going to see a whole lot of JavaScript on the server. So while some of you might not like the idea, it’s time to get used to it.

I for one welcome our new overlord. Given EJS is inevitable, are you ready?

UPDATE: here’s a great writeup on the current best of breed enterprise JavaScript stack. - React, node and some cute transport between them. - A great starting place.


UPDATE: A wonderful talk on Redux demonstrates the power of immutable state - it’s so nice to see how simple powerful things can be when you get it right, and React and Redux have definitely got it spot on - really recommend watching this - it’s worth every min:

(If you can’t watch the video, this cartoon will have to do.)

Check out CASH - a JavaScript shell for windows to give you cyg-win like powers…this is the beginning of something big.

Testing rocks as well in JavaScript - combining Object.assign and

chai-shallow-deep-equal allows you to assert many properties of an object at once in an elegant manner by just specifying the JSON you'd expect to be there. (How I wish we had this in c#!)