The ability of objects to be derived from and specialize more general objects is fundamental to any object-oriented system. Yet Microsoft deliberately excluded inheritance from OLE 2.0's object model. The problem, according to OLE developers, is that it's hard to specify a precise interface between a base object and a derived one.
For example, suppose an object inherits half of its behavior from the operating system and provides the other half itself. Now suppose that a new version of the operating system revises the base object while preserving its interface. In theory, the derived object should still work perfectly. This is the major selling point for object-oriented systems. IBM, for example, touts SOM (System Object Model) as a way to achieve binary reuse of objects.
But there can be hidden pitfalls, s
ay OLE developers. Suppose the derived object defines a virtual method that supersedes a method in the base object. Suppose also that the original version of the base object called this virtual method once after all its data was initialized. What if the new base object called the virtual method before some piece of data was initialized? The interface wouldn't be violated--parameters would still be passed correctly--but tacit assumptions made by the derived object's programmer could lead to trouble.
Microsoft therefore came up with the notion of aggregation, whereby programmers must explicitly build in the pointers from a derived object to a base object. This approach allows the programmer to build in controls that would stop the object from inheriting something in a dangerous way. The programmer could, for example, force the derived object to check the revision number of the base object.
In IBM's SOM, on the other hand, the dispatcher automatically uses the first instance of a base-class object
that it can find. This approach requires more discipline on the part of programmers, who must try to ensure that the derived code they write interacts with base-class objects from one revision to another.
Apple's Kurt Piersol is familiar with this dilemma, because OpenDoc's object model is SOM. He believes, however, that talented programmers deserve the freedom that inheritance brings and can handle the responsibility that it demands. Jim Green, director of the DOE (Distributed Objects Everywhere) project at Sun Microsystems, agrees, and he notes that Microsoft's is the only object system that imposes such strictness.
Who's right? Only time will tell. Objects are not standard equipment yet. When there's a broader base of experience, we'll see whether programmers will run amok with inheritance and come begging for forgiveness like the prodigal son.