In the case of relationships the context is the key

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: an object o is a subclass of p then all instances of o are also instances of p. So the subclass relationship is based on a monotonic set inclusion relationship of instances from subclass to superclass. 6 22 signature instead. 2.3.9 Inheritance The objective of organizing objects in a hierarchy of classes is to share properties of the objects in useful, economical, and meaningful ways. Properties of superclasses can be inherited by their various subclasses. The notion of inheritance in OR model is in uenced by the viewpoint we take in respect to objects and classes. Recall that we do not distinguish between class attributes and member attributes and allow subclasses to inherit methods and attributes from superclasses uniformly. This suggests that there is no distinction between the way an instance of a class inherits structure and properties from a class and a subclass inherits the same from the superclass. Hence from the inheritance point of view subclasses and instances can be viewed uniformly. Hence keeping a distinction between class and instance objects do not serve any useful purpose, and hence can be removed in OR model. This explains the dual nature of objects in OR model { object as a class and object as an instance. Which role an object takes at a given time now depends on how it is viewed. It is easy to see that using the constructs provided in OR model, we can, however, nicely model the conventional view of classes and instances. The class DC10-30 in our example inherits all the attributes in the class aircraft. In other words, the attributes and methods that are available in aircraft are also available in DC10-30. In this case, the inheritance is called monotonic. However, it is possible that a subclass or instance may not inherit all the properties from a superclass, because they do not make any sense in the subclass. For example, suppose that the class MD10 is a redesigned version of DC10-30 with almost no changes in the basic design of DC10-30, except perhaps a minor change in body structure and a radio replaced by a computerized radar (see Figure 1). Due to the merger of McDonnell and Douglas, the company name is changed to McDonnell Douglas. The DC10-30 s are still manufactured and maintained by the Douglas, but the MD family belongs to the new company. Clearly the company name in the attribute company in aircraft is not applicable to MD10. Somehow, the inheritance of the attribute company should be made ine ective in MD10. The way this situation is handled in the OR model is by using a non-monotonic inheritance. There are three mechanisms for achieving non-monotonic inheritance { inhibitance, blocking and overriding. Methods 23 or attributes may be overridden in a subclass or instance object. If a subclass or instance object rede nes a method implementation or the value of an attribute, then the corresponding method or attribute is not inherited and is said to be overridden in the subclass object. That is more speci c and recent de nition takes e ect. This is called speci city of properties. In our example, the value of company attribute in DC10-30 is \Douglas" while the value for this attribute in MD10 is \McDonnell Douglas". We say that company = \McDonnell Douglas" in MD10 overrides company = \Douglas" in DC10-30. In terms of method (intensional attribute) inheritance, we take the view that the implementation of the method is inherited in the subclass, not the value that is computed in the superclass. This implies that the procedure that implements the method in the superclass will now be evaluated in the context of the subclass by instantiating all self references in the procedure to the current class. It is important to observe here that the overriding semantics for methods de nitions in OR model is di erent from logic based models such as F-logic 47]. In OR model, even if the inherited procedure fails to compute anything in the subclass (null value), the subclass will not inherit the corresponding method evaluation (value) in the superclass, if any. This is in agreement with the method inheritance principles in most of the OO systems. A similar notion of inheritance is not available in SDMs. An inherited method in a subclass can be withdrawn by inhibiting it. On the other hand, inheritance of a method can be prevented by blocking it in the superclass. Withdrawal of signature implies withdrawal of data corresponding to a method type, but the converse is not true. Also, inhibition and blocking is symmetric and one implies the other but in the opposite direction. For instance, in MD10 we inhibit or withdraw the method radio (which would otherwise be inherited) from the superclass DC10-30. The methods radio and kitchens are selectively blocked in MD10A for B100, while cockpit in MD10A is blocked for all subclasses of MD10A by qualifying the method name with the intended class name. Re-introduction is a mechanism for inheriting a method from an ancestral superclass as long as it is not blocked. In MD10A, the radio...
View Full Document

This document was uploaded on 01/10/2011.

Ask a homework question - tutors are online