Umm javascript is okay… I guess…

People who know me are probably aware I have over years been fairly scathing about JavaScript as a serious programming language. I’ve been mostly a classical desktop and back end developer for a large part of my career, and as such have avoided web development. A large reason for this was playing with JavaScript and web development in the early 2000’s. It wasn’t pretty. A mess of functions, no types anywhere, a far cry from the elegance of Borland Delphi, which was my favourite language of the time, or even VB6, which I was using at work, which if nothing else, had a kick ass IDE (there really was nothing else).

For the last two years I’ve been working on the next generation version of our software at work, which, as all enterprise software is these days, entirely web based. Our front end stack is AngularJS, Node, and typescript, which has necessitated me learning Typescript, and by proxy, becoming au fait with modern JavaScript.

My opinion of JavaScript in 2018? It’s actually pretty good. The prototypal inheritance system is both unusual and useful. I really like the way you can chain the Boolean operators together for conditional and lazy execution of expressions. The fact that every JavaScript object is a dictionary that can be arbitrarily extended. JavaScript is also a first class functional programming language.

A big part of my new found admiration for JavaScript is the new ES2015 syntax (well not so new now…). The class syntax tidies up some of the rather odder parts of the object creation syntax, and arrow functions both simplify creating functions, and get around some of the more quirky behaviour of the “this” parameter.

TypeScript further embellishes JavaScript with a very decent stab at a type system on top of JavaScript as well as also allowing you to use the lastest JavaScript features and transpile down to more widely supported JavaScript.

It’s safe to say I’m a convert to the expressiveness of JavaScript, with or without TypeScript. Yes there are horrible bits, the implicit type conversions on ==, implicit semi-colon placement, everything in non-strict mode. But you can train yourself to stay out of these holes with very little effort, and as a programmer, learning the ways people use this quirky language can open your eyes to a whole new way of writing code. That can only be a good thing.

Leave a Reply

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