23.08.2013 Views

Specification of Reactive Hardware/Software Systems - Electronic ...

Specification of Reactive Hardware/Software Systems - Electronic ...

Specification of Reactive Hardware/Software Systems - Electronic ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

66 Abstraction <strong>of</strong> a Problem Domain<br />

which we call specification inheritance. Parts <strong>of</strong> the description specified in classes can be<br />

inherited and therefore reused. This appears to be a very limited form <strong>of</strong> inheritance.<br />

The form <strong>of</strong> inheritance is based on the subtype/supertype relation. Attributes and<br />

messages are specified in the subtype/supertype hierarchy <strong>of</strong> classes in Object Class<br />

Diagrams. Superclasses contain attributes and messages that are inherited by all their<br />

descendants. These collections <strong>of</strong> attributes and messages are reused in this way. The<br />

main issue here is that the concepts <strong>of</strong> specialisation, generalisation and <strong>of</strong> inheritance<br />

are used for structuring <strong>of</strong> the problem domain. Reuse is only a secondary issue.<br />

4.3.4.2 Implementation Inheritance<br />

In the object-oriented tradition, inheritance is explained as a mechanism that allows to<br />

reuse the (behaviour) definition <strong>of</strong> a class. We call this form implementation inheritance, to<br />

distinguish it from specification inheritance. Implementation inheritance is a form <strong>of</strong><br />

dynamic hierarchical resource sharing. It is a mechanism for reuse by means <strong>of</strong> code<br />

sharing. Code implements the objects operations. Each operation <strong>of</strong> all objects <strong>of</strong> a class<br />

is described only once in this class, or in one <strong>of</strong> the ancestor classes.<br />

In Paragraph 4.3.3.2 we interpreted the hierarchy in the tree shown in Figure 4.4 as<br />

supertype/subtype relations. Implementation inheritance interprets this hierarchy differently.<br />

An important aspect is the role for sharing code. Subclasses can inherit the<br />

code for operations from their ancestor classes. In object-oriented implementations this<br />

can be performed at run-time. When an object must perform an operation the code for<br />

this operation is first searched within the object’s class. If the operation is not found, the<br />

ancestors classes are searched successively.<br />

4.3.4.3 <strong>Specification</strong> Inheritance and Implementation Inheritance<br />

We choose to interpret inheritance as specification inheritance, which is consistent with<br />

the notion <strong>of</strong> subtyping. <strong>Specification</strong> inheritance is used in Object Class Diagrams,<br />

which <strong>of</strong>fer a conceptual view <strong>of</strong> the system to be designed. This view is formalised in a<br />

unified model described in POOSL. To describe specification inheritance, a type system<br />

for POOSL, supporting subtyping, will have to be developed. Further, to support reuse<br />

<strong>of</strong> specifications, implementation inheritance would have to be supported too. Currently,<br />

the POOSL language is untyped, and no implementation inheritance is <strong>of</strong>fered. Implementation<br />

inheritance and specification inheritance appear to be conflicting concepts.<br />

Problems with respect to type systems and implementation inheritance are described in<br />

[DT92, Hür94, Coo89, AL90, Ame89, AR89a, CHC90]. The development <strong>of</strong> an appropriate<br />

type system for POOSL that supports implementation inheritance is subject for<br />

future research.<br />

4.3.4.4 Implementation Inheritance and Encapsulation<br />

Another problem <strong>of</strong> implementation inheritance is that it violates encapsulation. This<br />

problem is described by Snyder [Sny86]. He states that the introduction <strong>of</strong> implementation<br />

inheritance severely compromises the benefits <strong>of</strong> encapsulation among classes.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!