Do Maximally Minimal classes carry their weight?

Erik Arvidsson erik.arvidsson at gmail.com
Mon Apr 2 14:39:07 PDT 2012


The main issue you will see if you do user studies on people trying to
do OOP in JS is that the way to set up the prototype chain in ES3/5 is
too hard. There is a reason why almost all JS libraries add ways to
make this easier.

With the "let C = B <| function() { ... }.prototype.{ ...
}.constructor" pattern we are making the default pattern even harder
to understand. Expecting people to get this is just too much to ask
for.

On Sat, Mar 31, 2012 at 10:40, Allen Wirfs-Brock <allen at wirfs-brock.com> wrote:
> What do you think?  Assuming that we will have some forms of enhanced object
> literals in ES6, are max-min classes also worth the additional complexity
> they add to the language?

I think the code samples shows how much a dedicated class syntax can
reduce the complexity, improves the readability and the intent of the
code.

Classes is a clear case of "Say what you mean!" whereas the
let-triangle-function-prototype-monocle-mustache-constructor pattern
is more like "I know how the internals work" which is hardly something
we should be pushing for.

-- 
erik


More information about the es-discuss mailing list