- Learn about prototypes. Design constructors that work how you expect. Re-introduce “new” into your code. Note: Many programmers stop here. And that is fine.
- Learn about Object.create, Object.getPrototypeOf. Mix and match constructors with just “raw” Object prototype usage. Monkey-patch native prototypes. Use prototypes to do everything.
- Come back to sanity. Use constructors+prototypes to define objects, but use Plain Old Functions more often. Prefer composition to “is-a” inheritance, but use is-a when it makes sense. Use
newand prototypes to create objects that all extend the same prototype, because, well, why not?
- Re-read the Gang of Four book that you once thought was so inspiring. Grok how the “class” pattern is just a special case of disciplined prototype re-use. Realize that prototypal inheritance makes a lot of those patterns trivial, and it’s a bit silly to spend so much time on them.
- Begin to notice actual applications that are best moduled with prototype chains. (Branching recursive file-system walks, configuration object overriding, inheritance trees, etc.)
I’m really wondering what’s next on this list.
The great thing about enlightenment is that it doesn’t end. It is continually extending itself in multiple non-overlapping directions.