The Classless Javascript Manifesto

Javascript Classes

ES6 added the class keyword to Javascript. This syntax is essentially a wrapper for the [[Prototype]] chain to make a more seamless transition for developers used to other object oriented languages. It abstracts out the conventional .prototype boilerplate.

So what are you saying?

We are proposing that Javascript developers avoid the class keyword in favor of clearer alternatives. Basically, there are lots of good reasons not to use the Javascript class keyword but the most important is that the class keyword hides a lot of the behind the scenes parts of Javascript and abstracts away from what is actually happening. Here is the real kicker

Classical inheritance (like classes) is not the same as Prototypal inheritance.

By confusing the two in our code, we do a disservice to ourselves and to other developers who must understand our code. It is much better to use a function or an object and work directly with the prototype.

Does anybody else think this is a good idea?

Some big JS people have written about classes and Javascript.

Here are a few links: