Evaluating Software Design Patterns
— the "Gang of Four" patterns implemented in Java 6

@Pattern(name="Facade", scope=Object, purpose=Structural, participants={"Facade","SubsystemClass"})

Package dk.rode.thesis.facade

Implementations and examples of the Facade design pattern [Gamma95, p.185].

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.
 

Package dk.rode.thesis.facade Description

Implementations and examples of the Facade design pattern [Gamma95, p.185].

Intent:

Here, the Facade participant is represented by the 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.

UML Class Diagram:

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]:

Author:
Gunni Rode / rode.dk

Gunni Rode / rode.dk

Feel free to use and/or modify the Java 6 source code developed for this thesis AT YOUR OWN RISK, but note that the source code comes WITHOUT ANY — and I do mean WITHOUT ANY — form of warranty WHAT SO EVER!

The original thesis and source code are available at rode.dk/thesis.