JavaScript Sucks. Yes, I said it. Microsoft's announcement of
TypeScript got me thinking today. Is this a step in the right direction? It sounds like it fixes some of problems with JavaScript development. But is it really just duct tape and super glue for a programming model that needs to be replaced?
I have had a love hate relationship with JavaScript, like most developers who would prefer avoiding client side code. I started doing web development over 10 years ago and I have done some pretty cool stuff with JavaScript. It has came a long ways and is the universal standard these days for client side scripting in the web browser. Over the years the browsers have become much faster at processing JavaScript. Now people are even trying to use it on the server side via node.js.
As an enterprise web application developer, I don't like any scripting or dynamic languages. I like code that compiles for lots of obvious reasons. JavaScript is messy to code with and lacks some modern programming features. There are compiling tools like Closure, jQuery, minify, coffee script, TypeScript and a bunch of other tools that have improved JavaScript. TypeScript looks like it will help with some of the problems like having variable types, compiling, and a better IDE to work with. We spend a lot of time trying to hack it to do things it was never really designed for. I don't think there is any point in debating in this post what the problems with JavaScript are. That isn't the point of the post and anyone who has used it has their own laundry list. (My favorite? Doing financial calculations in JavaScript is lots of fun.) The question is are we stuck with using JavaScript on the client side forever now? What alternatives do we have?
It is possible to program in Silverlight, Java or Flash and run that in the browser instead of JavaScript, but they all have their own problems and lack universal mobile support. I believe Microsoft's new TypeScript is a step forward for JavaScript, but I think we need to start planning to go a whole different direction. 10 years from now is JavaScript going to be the primary solution on the client side still? We need to start thinking about what replaces JavaScript... and I have no idea what the solution is.