Eric Elliott
Jul 21, 2017 · 1 min read

Apologies for the tone. Recognize I’ve had this conversation a million times and you clearly haven’t invested much time in preparing for this conversation, or you’d be prepared with an answer to the challenge. It comes across like you’re more interested in telling me I’m wrong than understanding.

I understand your argument. I just disagree, so if that’s why you’re still here, save us both the time and leave it here. Otherwise, read on.

If we should favor composition over class inheritance we can infer that we should only use class inheirtance when it makes sense.

In my first reply, I challenged you to answer that question, and you still haven’t. I’ve specialized in this topic deeply for well over a decade. I’ve written a book that featured it prominently. Spoke at conferences. Published blog posts read by hundreds of thousands of people, all challenged to answer the same question.

If I was going to find an answer with Google, I would have. I feel a bit like a scientist asking for evidence that ghosts exist. Lots of people believe in them but nobody has convincing evidence.

In Java it’s easy to understand why the GoF said “favor” because composition is hard in Java. In JS, that’s not the case, so justifying class inheritance gets a LOT harder.

Take a swing if you want. You’ll see what I mean.

)

Eric Elliott

Written by

Make some magic. #JavaScript