Exploring safe patterns for class inheritance


#1

Right before joining the group, I was creating an early scaffold of a long term experiment to implement a bootstrappable module system based on the non-ESM Node.js design using classes.

Personally, I advocate for the use of classes here merely as a tool, and like any other should be used correctly or not used at all. Correct use of classes is not unheard of, but is for all intents and purposes a common as how much people are willing to use them when they are the right tool.

A couple of weeks ago, nearing the end of our meeting there was an opportunity to do a quick walk-through of the very early code I’d written which only addressed limited scope of ensuring safe class-based encapsulation and inheritance. Positive feedback leads me to want to pursue this further.

Here is my rationale on why this is important:

  1. Classes will show up, they are a thing in ECMAScript.
  2. When they show up they often show up in bad form.
  3. The can have good form, but that is largely uncharted territory.
  4. Uncharted is not unreachable, and reachable is always hackable.

Charting a roadmap that would increase adoption of safer class-based encapsulation and inheritance by the community at large can take the form of design patterns and recommended practices documents.

Where do we begin?

Note: I wasn’t sure how to categorize this and welcome your suggestions!