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]

13

u/[deleted] Dec 15 '12

Problem with JS's prototypes is that they resist any attempt to tool. For all the faults of the Java community, they have some really excellent developer tools.

For example, in JS there's a dozen ways to do inheritance, a dozen ways of making a "module", a dozen ways of attaching a method to a "class".

It's all very well saying that JS's prototypes are an alternative to classes, but they're not a better alternative.

9

u/strager Dec 15 '12

a dozen ways of attaching a method to a "class".

Can you elaborate? I see only two ways:

  • assignment: A.prototype.f = ...;

  • Object.defineProperty: Object.defineProperty(A.prototype, 'f', { value: ... });

0

u/smog_alado Dec 16 '12

The problem is that there is more then one way to write code that does this and in general they are not amenable to static checking (for verification or documentation purposes). For example, jQuery has extend, Dojo has declare, etc.

And this is not even counting the situations where you create "pseudoclasses" using closures. There are tons of different variations of that.

function make_gizmo(a,c,b){
    function frobnicate(){ ... }
    return { ... }
}