composition

Object-Oriented JavaScript – Pseudo-Classical Class Pattern

Object-Oriented JavaScript – Pseudo-Classical Class Pattern 1280 853 Clark

The benefit of a pseudo-classical pattern in JS is that only one instance of each method is created regardless of how many instances of the object are created.

read more

Object-Oriented JavaScript – Prototypal Class Pattern

Object-Oriented JavaScript – Prototypal Class Pattern 1280 719 Clark

The Prototypal Class pattern is fundamental to JavaScript, especially object-oriented JavaScript. Though used infrequently by developers, this pattern underpins the syntactic sugar provided by the new keyword and the ES6+ class — thus, worth learning.

read more

Object-Oriented JavaScript – Functional-Shared Class Pattern

Object-Oriented JavaScript – Functional-Shared Class Pattern 150 150 Clark

Often referred to as a ‘mixin,’ this compositional style extends an instance to add shared functionality.

read more

Object-Oriented JavaScript – Functional Class Pattern

Object-Oriented JavaScript – Functional Class Pattern 150 150 Clark

The Functional Class pattern, though simple and clear, suffers from its naïveté. Forced to create duplicate methods for every instance, and store significant closure state for each function on the instance, the memory overhead outweighs the clarity of this pattern.

read more

Shakin’ Class: Pianos in Different Area Codes

Shakin’ Class: Pianos in Different Area Codes 150 150 Clark

There are a lot of ways to model objects in our world – a globe to represent earth, a popsicle-stick art project to model a real building, a drawing to represent statue, a mathematical equation to model a beehive, a Minkowski spacetime diagram to model space and time, ad infinitum.…

read more