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

Show parent comments

0

u/[deleted] Dec 16 '12

[deleted]

0

u/x-skeww Dec 16 '12

What I meant is that adding classes is not going to make it any easier or harder to write stuff in JS.

Classes and inheritance provided by the language itself will make it easier, because tools can now tell what you're doing.

It will be also easier because there is now one way to do it, not hundreds.

If you don't like that then code in a static language like Haskell.

You don't have that kind of issue with Dart either. If I use some "foo" function from some "bar" class from some "baz" package... then that's what it is. If it returns an int, then that's what it does.

There are namespaces and there is no monkey patching. Everything is known at the time the code is written. Java and C# are also like that, for example. That's also the reason why IDEs of those languages can offer proper call-tips and on-the-fly sanity checks. They can tell what everything is. You can't have that kind of thing with JavaScript, because there is no way to tell what anything is.

And yes, I do also know the revealing module pattern. It's not a namespacing mechanism though. It gives you some object with public and private (=hidden in a closure) properties.

Most people use one global variable, stick everything into it, and then they hope that nothing else will overwrite it. That's the kind of "namespacing" we have in JavaScript.

0

u/[deleted] Dec 17 '12

[deleted]

-1

u/x-skeww Dec 17 '12

You're a static language aficionado.

No, I'm not.

There are cross compilers that will take Java and C# and output JS so you should be doing that instead.

I prefer Dart. (It's dynamic, by the way.)

Learn to use the language the way it's meant to be used and you will have a better time.

I did. I wrote a few jQuery plugins, hundreds of small modules, various command line tools, grunt tasks, MVC & MVP applications, and simple games. I read 5 books and watched dozens of talks. I read many articles and participated in many discussions.

Unsurprisingly, I arrived at the same conclusion as everyone else: JavaScript scales poorly. Also, its tooling is very bad and there is no way to fix it. Ever.

AS3, for example, is very similar to JavaScript. Well, it's based on that discarded ES4 spec. So, no surprise there, really. However, writing larger applications with AS3 is a lot easier than doing the same with JS, because you have packages, classes, types, a smarter IDE, and things like that.

It's really nice if the language provides some structure.

Well, I still like JavaScript and I also still think that it's lots of fun to use. It just doesn't seem to be suitable for writing bigger applications with many people.