David Colwell
Jul 21, 2017 · 2 min read

Not to confuse things, but I’d like to share my personal opinion here (I believe something similar has already been sort of alluded to already).

I’ve been developing it since it was LiveScript. I consider it an amazing language. Engineering and developing in JavaScript is unquestionably a very different beast than most traditional languages. The fact that Class inheritance has been introduced in ES6 is important to know about. Whether to “prefer” it over composition is something that — in my world depends …on lots of things.

It will be defined as a preferred approach depending on the team I have to work with, and the amount of time/resources I have for seeing the team trained around a proper approach to functional composition.

It’s amazing how far front-end developers can get with a relatively shallow understanding of JavaScript. They can become Sr devs these days without having a true grasp and appreciation of the underlying prototypal nature of the language. Unfortunate, but more tragically common.

When would I choose to prefer Class based inheritance?

If I suspect the code-base/project will have regular rotation of developers who’s JavaScript skill level I can’t be confident will be deep enough, and I won’t have the luxury of saying every developer must learn certain concepts before touching the code…I may prefer Class based inheritance for module creation and encapsulation.

When would I prefer functional module composition?

If I can be reasonably confident that I can expect developers coming to the codebase (especially when I’m not available to guide them) will have the level of understanding and skill I consider necessary…then composition is so much more flexible and productive — in my personal experience and opinion.

)

    David Colwell

    Written by

    UX/Usability specialist, coach for Lean UX/Agile teams, Full Stack Architect, pixel pusher, enabler of tech addictions, PsychoDaddy, Sir Galahad to my Zoot...