The one ECMAScript it’s still okay to like, JavaScript has in recent years shrugged off its ‘under-powered’, ‘bloated’ and ‘incomplete’ labels and grown into the universal go-to solution for front-end scripting.
Go to your drawer and pull out that résumé from 5 years ago. Now find the skills section and see where you listed ‘JavaScript’; a buck says it’s down the bottom, just above DHTML and FrontPage. Right now, JavaScript is one of the hottest skills a web developer can have. If it’s not at the top of your résumé skillset, just under HTML5 and CSS3, then it should be.
The biggest boon to JavaScript’s new found street cred is undoubtedly jQuery, but there are a plethora of interesting projects that orbit the JavaScript core. These projects have a tendency to try and ‘fix’ JavaScript. Like the girlfriend/boyfriend that moves in, then starts to re-order your record collection. It may be necessary, but it sure isn’t polite.
The problem with JavaScript isn’t that it’s awkward, or inefficient. It’s that too many developers are infuriated by the idea that this snot-nosed little upstart of a scripting language (they won’t let us call it a programming language) could ever be used for anything serious. Except of course that JavaScript is being used for all manner of high-brow solutions. JavaScript is the proverbial orphan that finds a winning lottery ticket in the gutter; suddenly everyone wants to be its guardian.
The latest Daddy Warbucks (or Fagin if you prefer) is Microsoft. Their development teams, tired of wrestling with the lack of error checking when building large scale apps in JavaScript, turned to Anders Hejlsberg for a solution. Hejlsberg, previously responsible for C# amongst other things, determined that what JavaScript lacked was an OO (object orientated) approach. So that’s what he delivered in the form of TypeScript.
TypeScript is being called a new language, but more accurately it’s a superset of JavaScript that compiles into JavaScript. Unlike Google’s Dart project TypeScript doesn’t seek to extend JavaScript’s behaviour, merely to organize JavaScript into a form more recognisable to Microsoft’s programmers. It aims to do for JavaScript applications, what jQuery did for JavaScript animation.
Naturally TypeScript is available as a plugin for Visual Studio, but it’s also available via Node.js and it’s open source. Unfortunately the error-checking that is the real time-saver of TypeScript is only available in Visual Studio, so it’s unlikely to make waves outside of the Windows platform.
The language itself doesn’t appear half-bad. The truth is that OOP is something that JavaScript is badly lacking. Expect to see revisions in the not-too-distant future though; static typing is optional in TypeScript, something that Adobe were rumoured to have attempted with Actionscript 3 before they determined the language was more robust when static typing was compulsory.
The community response to TypeScript has been mixed to say the least: exuberance from the C# crowd who’ve previously viewed JavaScript as infantile; cynicism from JavaScript developers who suspect Microsoft is laying claim to JavaScript just as Apple have tried to do with HTML5.
In reality, TypeScript is a good tool, it makes JavaScript a more attractive option for large projects, and for Visual Studio users it introduces error-checking. However, TypeScript’s user base won’t be the existing JavaScript community who have long since embraced its shortcomings; it will be the C# programmers, who until now have never quite been able to bend their mindset towards JavaScript.
Are you a Visual Studio user? Do you think TypeScript offers a new direction for JavaScript? Let us know in the comments.