2 research outputs found
Composite objects: dynamic representation and encapsulation by static classification of object references
The composition of several objects to one higher-level, composite object is a central
technique in the construction of object-oriented software systems and for the management
of their structural and dynamic complexity. Standard object-oriented programming
languages, however, focus their support on the elementary objects and on class
inheritance (the other central technique). They do not provide for the expression of
objects' composition, and do not ensure any kind of encapsulation of composite objects.
In particular, there is no guarantee that composite objects control the changes
of their own state (state encapsulation).
We propose to advance software quality by new program annotations that document
the design with respect to object composition and, based on them, new static
checks that exclude designs violating the encapsulation of composite objects' state.
No significant restrictions are imposed on the composite objects' internal structure
and dynamic construction. Common design patterns like Iterators and Abstract Factories
are supported.
We extend a subset of the Java language by mode annotations at all types of object
references, and a user-specified classification of all methods into potentially state changing
mutators and read-only observers. The modes superimpose composition
relationships between objects connected by paths of references at run-time. The
proposed mode system limits, orthogonally to the type system, the invocation of
mutator methods (depending on the mode of the reference to the receiver object),
the permissibility of reference passing (as parameter or result), and the compatibility
between references of different modes. These restrictions statically guarantee state
encapsulation relative to the mode-expressed object composition structure