Notes from Heck

Getting Serious with JavaScript

My recent decision to teach myself Node.js has turned out to be a good one. It runs on Google Chrome's V8 JS engine and leverages JavaScript's event model to provide non-blocking IO, allowing for fast, responsive applications that scale extremely well, even on low-end hardware.

Being a web developer for a few years now, I was already familiar with basic JavaScript, so the learning curve wasn't greatly steepened on account of having to learn a whole new language. I did have to make a quantum leap in my outlook towards JS as a serious programming language though - what once used to be the silent underdog, used for writing a few onClick event handlers, and for sprinkling AJAX calls all over web pages, has now come into its own. Server-side JS programming really requires a much deeper and thorough understanding of the language and its associated design and programming paradigms than ever a alert('Your password must contain at least 6 numbers and 4 Egyptian hieroglyphs') has called for. With widespread adoption in both server-side and client-side programming, JavaScript is now a true isomorphic language.

Needless to say, my JS knowledge base required a few upgrades before I could put together anything smarter than a 'Hello World' responder. Said upgrades, among other excellent sources, I have found here, here, here along with the JS object graph learning trail (part 1, part 2 and part 3). In fact, most of How to Node is a must-read if you're planning on serious Node programming.

But this post is not just about my experience learning server-side JS. In the process of upgrading my overall web development repertoire, I've had to undergo quite a steep ramp-up on client-side JS technologies as well - not least of which was AngularJS. Ran into this fellow while looking for a good client side toolkit for building RIAs, especially one that was best suited for single page applications.

Back then, my feet were firmly planted on Java turf (in spite of it showing obvious signs of age), and I was looking for a client library that would work well with Java on the server side. Did a few rounds of GWT, ZK, Vaadin and kin until I realized that all of these frameworks incurred a significant learning curve, tedious integration points to cooperate with custom Spring stacks, limited and buggy IDE support (among open-source IDEs, including STS and IDEA community edition; don't know about IDEA Pro), and no small amount of code bloat on the server side in spite of auto-magic scaffolding and suchlike voodoo. Servers would have to carry out a lot of deeply nested processing to build the views for presenting to the client (esp. in frameworks that took the 'pain' of writing client-side javascript away from developers, by auto-generating it from java code).

The biggest problem still, was the lack of flexibility, in spite of all the automation and scaffolding (or perhaps because of it), in building a custom UI to one's exact liking (esp. with dynamic scaffolding, where you lose significant control over the finally generated DOM). Including client-side styling libraries like Bootstrap would require jumping through increasingly tight hoops in order to make the auto-generated templates adhere to the specific DOM and CSS requirements dictated by such libraries.

I don't remember if it was by chance, or deliberate intent (esp. since I was previously aware of jQuery UI) that my search led me to the discovery of pure client-side presentation technologies. The first one I tried (and was amply impressed by), was Knockout. This was really an 'Aha!' moment for me. One go at their live tutorial was enough to convince me of the potential of JavaScript to completely take over the client-side presenting/rendering business, greatly simplifying things on the server side, which now need bother about little more (w.r.t. presentation) than furnishing the HTML template and the JSON data upon which the JS framework could go to work.

Having discovered this entirely new (to me) method of structuring webapps, which basically addresses all the pain points mentioned above, I went about hunting for other similar offerings in the browser space; but by now I was convinced of JavaScript's ability to be much more than just an errand boy.

As of today, I'm still delving deeper into the fascinating world of server-side JS runtimes, the accompanying middleware (Connect and Express being among the biggest names here), while also being repeatedly amazed by the power of modern client-side frameworks. The JS landscape is already incredibly expansive, and continues to grow at a frightful rate, as each day heralds the launch of several new libraries, frameworks and tools that make JS programming all the more exciting and enlightening.

My journey of exploration has already started bearing fruit, and has empowered me to give back to the wonderful open source community (JS or otherwise) that I have received so much from.

Author image
Bangalore, India Upwork Profile
I’m a developer, a hobbyist biker, and a Linux enthusiast. When not riding into the sunset, and not being a general nuisance, I like to experiment with new systems and concepts in technology.