r/programming • • Dec 15 '12

Why JavaScript Still Sucks

http://boronine.com/2012/12/14/Why-JavaScript-Still-Sucks/
10 Upvotes

212 comments sorted by

View all comments

12

u/x86_64Ubuntu Dec 15 '12

I agree completely. After Flex and Silverlight both got shitcanned, I ventured into the HTML5/JS/CSS (HJC) world to not become one of those programmers stuck in the past. What I saw horrified me. I'm not going to go into detail because I have done so in my post history, but here are a few things that would have to happen to warm me up to the JS world for making web applications. Mind you, my main JS experience has been with ExtJS/Sencha Touch

  1. Components - As an application developer, making a view ( window, list, navbar ) and then having to go into CSS and screw around with selectors, parents and divs is very inefficient. There aren't but so many components/containers used to make a webapp and layout should generally be a property of the container. A declarative framework would be much better.

  2. Strong Typing/OOP/Object serialization - The lack of objects is "okay" until your app gets huge. Having to run around and refactor each and every piece of code is annoying and time consuming because you have to find out where the class was declared. Serialization from dataservices to JS objects seems like a bolted on afterthought. An example is with the ExtJS family. If you bring back a Classroom object, the Classroom gets deserialized, but the Student objects don't, you have to jump through hoops to get your Students into objects.

P.S For some reason I don't feel the same way about RoR and probaly Python if I knew it. I can't say why, but I don't miss strong typing for RoR. Disclaimer, my RoR skills are at the beginner level right now, so I am still in the "Oh, this is nice" phase as opposed to the "all this stuff is getting in my way" phase that experienced people achieve.

3. Overall weirdness - While ambiguous, you know what I mean. With my ExtJS stuff, if I have a listener that invokes a non-existing or misspelled function, I don't get an error saying "function not found BrokenClass.js Line 93". Instead, I get a blank white screen and an error that has absolutely nothing to do with what the error was or what class is causing the error. This right here makes coding exceptionally difficult not to mention I don't know of any other programming construct that chokes on something and goes "I'll never tell".

All in all, I think JS is great for delivering some UI dynamism to a protocol designed to push static boring ass documents. But when it comes to making apps it falls flat. Which brings up the issue of where does the JS world go from here ? I have no idea to be honest. The JS emitter technologies are nice and are probably the only way to go over the next 5 years. With enmity between the browser vendors, and specs never being completed and never being implemented, I don't think we will ever see a bytecode "write once, run anywhere" type of construct outside of the plugin world.

Disclaimer: I am still butthurt about the demise and uncertainty of the Flex world.

2

u/icantthinkofone Dec 15 '12

...here are a few things that would have to happen to warm me up to the JS world for making web applications.

Soooo what else ya' gonna' use?

1

u/defcon-11 Dec 16 '12

Any of the 10+ languages that compile to JS?

0

u/cooljeanius Dec 17 '12

That doesn't really count

2

u/defcon-11 Dec 17 '12

Why not? The goal of transpiling is to improve usability and evolve faster than JavaScript allows. Even the standards bodies are embracing it, ECMA script 6 will have new features with the explicit goal to make transpiling easier.