JavaScript Sucks.

Posted by Matt Watson on Geeks with Blogs See other posts from Geeks with Blogs or by Matt Watson
Published on Mon, 01 Oct 2012 19:09:01 GMT Indexed on 2012/10/02 3:38 UTC
Read the original article Hit count: 458

Filed under:
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 a lot 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. 

OK, so why do I think JavaScript sucks?

Well first off, 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. It is messy to code with and lacks all kinds of modern programming features. We spend a lot of time trying to hack it to do things it was never really designed for.

Ever try to use different jQuery based plugins that require conflicting jQuery versions? Yeah, that sucks.

How about trying to figure out how to make 20 javascript include files load quicker as one request? Yeah that sucks too.

Performance? Let me just point to the old Facebook mobile app made with JS & HTML5. It sucked. Enough said.

How about unit testing JavaScript? I've never tried it, but it sure sounds like fun.

My biggest problem with JavaScript is code security. If I make some awesome product, there is no way to protect my code. How can we expect game makers to write apps in 100% JavaScript and HTML5 if they can't protect their intellectual property?

There are compiling tools like Closure, unit test frameworks, minify, coffee script, TypeScript and a bunch of other tools. But to me, they all try to make up for the weaknesses and problems with JavaScript. JavaScript is a mess and we spend a lot of time trying to work around all of it's problems. 

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. We need a new universal client side programming model, because JavaScript sucks.

© Geeks with Blogs or respective owner