Inheritance Considered Harmful

Douglas Crockford crockford@earthlink.net
Fri, 23 Oct 1998 08:10:59 -0700


I believe that inheritance is evil. I also believe that people who agree
with this important observation are correct. Just as we shunned the GO TO,
we should shun the COME FROM.

And then there is E. Mark has chosen as one of his design goals to make E a
successful and popular language, recognizing that this is often incompatible
with the goal of making an ideal language. Others have pointed out that C++
is clearly the worst of the object-oriented languages, and is also clearly
the most successful and popular. One has to be careful to not draw the
conclusion that badness==success.

There are many things I don't like about E. The C-style syntax offends my
eye. And after a quarter century of experience with word processing and
hypertext, the representation of program texts is still modeled after paper
tape.

But there are things I love about E, particularly the concurrency model,
the communication model, and the security model. These are wonderful  and
powerful, and not available elsewhere.

I think that you have to be careful in selecting your innovations. If you
innovate on too many fronts, you will get praised by people like us, and
ignored by the marketplace.

So, I think the question is not "Is inheritance evil?" for I have correctly
answered that question: It is. Instead we should be asking: "Does
inheritance increase or diminish E's chances of success?"

My hunch is that E will be more successful without inheritance. Mark has
targeted an audience of scripting-language users, folks who generally do not
use inheritance, and so might enjoy a simpler language.