This is a response to an article on the dbdebunkings.com site called "Is a Circle an Ellipse"?:
First of all, let me say that I love your site. I am a much better-informed person for reading it.
Secondly, let me say that you, like most people even in the OO community, have missed what inheritance is really about. As you know, many people in the database community have missed what databases are all about, so it's shouldn't come as a surprise to you that other computer fields have the same problems.
The article focused on inheritance as a type/subtype relationship. There are two ways to define type/subtype relationships - by restriction or generalization. Neither of these are useful for object-oriented programming.
Object-oriented programming is defined by one thing - interfaces. The ability for an object to "do" something. In your circle/ellipse example, you did not list any operations for them to "do", so it is impossible to tell what kind of relationship they would have in the object-oriented programming world. For example, if they both implemented a function called "enlarge", then they would both implement the interface Enlargeable. In fact, squares and pentagons could be part of this category as well. With this in place, an application can enlarge an object independent of what type it is, or what data it carries.
My philosophy teacher always asked "how do you define a chair"? He gave possible examples - a flat board with four legs and a back. However, this did not work for three-legged chairs. Any definition along these lines would fail for some chair invented somewhere. The bean-bag chairs really threw people. However, this is because it needed an operational definition - a chair is something that you sit on. Or, in computer terms, implements the SitOn interface. Object-oriented programming gives operational definitions, and thus makes itself a very powerful tool in programming.
Interestingly, this makes object-oriented programming completely orthogonal to databases, since one deals with the operational characteristics and the other deals with the data and data dependencies of a system.
Anyway, I wrote a short paper on this in college - you can read it at
http://www.eskimo.com/~johnnyb/computers/FactoringInheritance/
|