This chapter explored
techniques that may be used to
structure object-oriented programs.
These techniques may be regarded as
idioms or guidelines augmenting
the mechanisms provided by object-oriented languages.
1
- virtual functions -- scoping, recursion
- invariant properties -- hidden features
- the diamond structure -- hiding realizations
slide: Section 7.1: Composition by inheritance
In section 1,
we looked at the problems
that may occur when employing
virtual functions and explicit scoping,
in particular in the presence of recursion,
how to maintain invariance when using
inheritance,
and we discussed the diamond structure
for the realization of compound objects.
2
- hiding -- functional behavior, interface
- smart pointers -- object management
- abstraction -- interface, realization
- roles -- dynamic switching
slide: Section 7.2: Interaction through delegation
In section 2,
an example was given demonstrating
implicit delegation in C++.
Also, we looked at the notion
of smart pointers.
Delegation underlies the envelope/letter
idiom which allows for separating the
interface of a data type from its
realization.
We also discussed an example
of dynamic role switching,
employing explicit delegation.
3
- gadgets -- require, damage and draw
- events -- interception, callbacks
- MV(C) -- model, view, control
slide: Section 7.3: Indirect cooperation
In section 3,
we looked at some patterns of
cooperation between objects.
The examples were inspired
by solutions employed in the Interviews
user interface development library.
Also, a schematic implementation
of the Smalltalk MV(C) paradigm
was given.
4
- abstract system -- functional behavior
- user interface -- displayer, prompter
- events -- to define interactions
- dependencies -- interconnections between events
slide: Section 7.4: Event-driven control
Finally, in section 4, we looked at an example demonstrating
event-driven control.
Events provide a powerful abstraction
to define the interaction of objects
in response to a user action.