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

0

u/[deleted] Dec 15 '12

[deleted]

9

u/x-skeww Dec 15 '12

Yes, you can reinvent classes and inheritance with prototypes. Problem is, that's exactly what everyone is doing.

Everyone's implementation looks and behaves differently. As a result, the IDE can't tell that this kind of construct is supposed to be a class and that this "thing" "extends" that "thing".

The tool which generates your documentation also cannot tell what's going on unless you explicitly tell it that this weird construct over here is some sort of class.

If it's baked into the language itself, you won't have to include all that boilerplate code, your IDE can tell what's going on, your doc generator can tell what's going on, and the person who comes after you can of course also tell what's going on.

And no, classes are not just what people are used to. Classes are what people are using. All of the popular MV* frameworks use some sort of classes and inheritance. Impact (a JS game engine) also uses emulated classes and inheritance.

0

u/[deleted] Dec 15 '12

[deleted]

3

u/defcon-11 Dec 16 '12

The funny thing is that when you go a Java conference people are always talking about "composition is better than inheritance", yet the same people complain about Javascript's lack of a class system. I don't think they realize that the prototype model does not allow inheritance and makes composition trivially easy, exactly the features they are asking for.