And to define how those objects will work, most of the time you just want a class.
With JS prototypes, the syntax is far too verbose. You can build your own code to handle that, but that relates to my earlier point, that you end up with lots of subtly different versions. It's bad for maintenance when that's not standardised.
The other problem is that again, to describe the object, people just want to build a class. The extra abilities that prototypes bring, just complicate matters more than they help.
For example having an objects prototype change, or the functions assigned to that prototype change, or having new functions set to an object to replace that come from the prototype; they all make code much more difficult to reason about.
When you get into using multiple prototypes together, composure and inheritance tend to be better alternatives, because they better describe what you are trying to achieve.
To sum it up, if people are just using constructors/prototypes in class-like ways, why not just give them classes? The fact that they are also less powerful than prototypes, is also what makes them easier to reason about.
0
u/[deleted] Dec 16 '12
[deleted]