[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: About Inheritance
- From: Martin_Doering@...
- Date: Wed, 5 Jul 2000 15:44:40 +0200
Here is a snippet from
Scripting: Higher Level Programming for the 21st Century
John K. Ousterhout
I found it quite interesting, because a short time ago I read about
inheritnace in the Lua papers. Maybe you are interested too.
Another problem with object-oriented languages is their emphasis on
inheritance. Implementation inheritance, where one class borrows code that
was written for another class, is a bad idea that makes software harder to
manage and reuse. It binds the implementations of classes together so that
neither class can be understood without the other: a subclass cannot be
understood without knowing how the inherited methods are implemented in
its superclass, and a superclass cannot be understood without knowing how
its methods are inherited in subclasses. In a complex class hierarchy, no
individual class can be understood without understanding all the other
classes in the hierarchy. Even worse, a class cannot be separated from its
hierarchy for reuse. Multiple inheritance makes these problems even worse.
Implementation inheritance causes the same intertwining and brittleness
that have been observed when goto statements are overused. As a result, object-oriented systems often
suffer from complexity and lack of reuse.
So I'm glad, that inheritance in Lua is just an option. For most scripts I
would write I would not need this. And it would make the language itself
more complex if totally integrated in it, like in e.g. Python.