View this PageEdit this Page (locked)Attachments to this PageHistory of this PageHomeRecent ChangesSearch the SwikiHelp Guide
Hotspots: Admin Pages | Turn-in Site |
Current Links: Cases Final Project Summer 2007

Discussion 1 - Brian Henke

Encapsulation and Inheritance in Object-Oriented Programming Languages
By Alan Snyder
June 1986

I found it on ACM, but here it is just in case....
http://www.prism.gatech.edu/~gtg884s/publicfolder/Encapsulation&Inheritance.pdf

I would say that a good overview of this article is that with Object-oriented languages there are certain features that should be done one way and not the other. These problem areas change with different languages.

Subtyping which are the rules for acceptable objects of one type (class) are used in context expecting another type (class). "In statically-typed languages like Trellis/Owl, Simula, and C++, subtyping rules are of critical importance because they determine the legality of programs. In dynamically-typed languages like Common Lisp, subtyping rules affect the results of type predicates." There are problems associated with subtyping and the article tells us that subtyping should not be tied to inheritance.

There is a section that speaks of accessing inherited variables safely. Self is said to not be sufficient because it often calls the wrong operation. That is if the operation is redefined later in the hierarchy. Smalltalk is then said to provide super in the manner of single inheritance. Other languages such as Trellis/Owl, extended Smalltalk, Java, and C++ use the parent invocation. Another property that OOP languages use is the method to encapsulate certain aspects of the object that shouldnít be used by other objects. Sometimes these objects are their own descendants.

Another issue that arises is multiple inheritances. In most languages, however, the introduction of inheritance severely compromises the benefits of encapsulation. It is necessary for inheritance to be made safely. Methods with them same name from multiple parents can cause problems. A lot of the relatively newer languages at the time of this article such as CommonObjects, Trellis/Owl, and C++ correct this problem with more strict rules of inheritance and linear trees of inheritance.

I read Robert Simpsonís article on units in different languages. His article explains how different languages derive and use their inherited units. He tells how in Java that all objects extend from java.lang.Object and that other languages do it differently. My article goes along with Robertís because it explains the pitfalls that occur when making these inheritances in languages.

Link to this Page