Not Awesome: ES6 Classes
A curated list of resources on why ES6 (aka ES2015) classes are NOT awesome
Table of Contents
- Many believe prototypal inheritance to be more flexible and freeing than classical inheritance due to its less rigid nature.
- The ES6 class syntax, constructors, the
- While prototypal inheritance is very powerful in its own right, there is a growing movement among developers, both within and outside of the JS community (Ex: Composition in Golang), to shift away from inheritance in favor of object composition.
- Instead of ES6 classes, you should consider factory functions, object composition, and/or prototypal inheritance via the use of prototypes, object literals, Object.create(), Object.assign(), etc. while avoiding constructors and the
“If a feature is sometimes dangerous, and there is a better option, then always use the better option.”
- Composition over Inheritance
- How to Fix the ES6
- Introducing the Stamp Specification -- Move Over,
class: Composable Factory Functions Are Here
- Think twice about ES6 classes
- Ashley Williams: If you wish to learn ES6/2015 from scratch, you must first invent the universe
- Composition over inheritance
- Douglas Crockford: The Better Parts - JSConfUY 2014
- Fluent 2013 - Eric Elliott, "Classical Inheritance is Obsolete: How to Think in Prototypal OO"
- Nordic.js 2014 • Douglas Crockford - The Better Parts
Please, ensure your pull request adheres to the following guidelines:
- Search previous suggestions before making a new one, as yours may be a duplicate.
- Make an individual pull request for each suggestion.
- Titles should be capitalized.
- Use the following format:
[Content Title](content link)
- Choose corresponding section (Reading, Videos, etc.) for your suggestion.
- New categories or improvements to the existing categorization are welcome. I would like to add a Tutorials/Examples section at some point. Feel free to get started on that if you have the time.
- The pull request and commit should have clear and useful titles.
- Each section's list, after your addition, should be sorted alphabetically.
This work is licensed under a Creative Commons Attribution 4.0 International License.