|
Evaluating Software Design Patterns — the "Gang of Four" patterns implemented in Java 6 |
||||||||
| PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES | ||||||||
See:
Description
| Class Summary | |
|---|---|
| AckermannSequence | An Ackermann sequence calculates the next value of the Ackermann function,
v = A(m, n), each time AckermannSequence.next() is invoked, using a fixed value for
m and thus increasing n, either indefinitely, or until a maximum
value has been reached. |
| FibonacciSequence | A Fibonacci sequence represents an integer sequence, where
each number delivered by FibonacciSequence.next() is the sum of the two
preceding numbers, except one which is the initial value:
1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, .. |
| Main | Facade tests. |
| MathFacade | A math facade is a small math library that represents an-easy-to-use high-level interface for complex mathematical functions. |
| RandomSequence | A random sequence returns a pseudo integer random number
with each call to RandomSequence.next() between [0, maximum], where
maximum is supplied at construction time. |
| UnboundedRandomSequence | An unbounded random sequence returns a pseudo integer random number
with each call to UnboundedRandomSequence.next() with no upper bound. |
Implementations and examples of the Facade design pattern [Gamma95, p.185].
Intent:
Provide a unified interface to a set of interfaces in a sub—system. Facade defines a higher—level interface that makes the sub—system easier to use.
MathFacade class. It supplies an
an-easy-to-use high-level interface to complex mathematical
functions that internally are implemented using various
Sequence types.
Specific SubsystemClass participants defined in this package are
AckermannSequence,
FibonacciSequence,
RandomSequence, and
UnboundedRandomSequence,
while various classes from other packages are also used to
represent sub-system classes, for example
SequenceIterator and
ReversiblePrimeSequence.

Implementation notes:
The small examples used throughout this thesis does not really
justify use of Facade; they are simply not complex enough. Still,
this Facade implementation address several issues discussed by
Gamma et al. [Gamma95, p.185-193]:
Sequence types
are too verbose and tedious to be implemented by any client, and hence
this facade help provide the desired functionality, shielding clients
from the gory details.
AckermannSequence class.
|
Gunni Rode / rode.dk | ||||||||
| PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES | ||||||||