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

Evaluating Software Design Patterns

— the "Gang of Four" patterns implemented in Java 6

Abstract:
In this project, we perform an evaluation of the "Gang of Four" design patterns from a practical and experimental point of view using Java 6 as the implementation language.

See:
          Description

Packages
dk.rode.thesis.abstractfactory Implementations and examples of the Abstract Factory design pattern [Gamma95, p.87].
dk.rode.thesis.adapter Implementations and examples of the Adapter design pattern [Gamma95, p.139].
dk.rode.thesis.bridge Implementations and examples of the Bridge design pattern [Gamma95, p.151].
dk.rode.thesis.builder Implementations and examples of the Builder design pattern [Gamma95, p.97].
dk.rode.thesis.chainofresponsibility Implementations and examples of the Chain of Responsibility design pattern [Gamma95, p.223].
dk.rode.thesis.command Implementations and examples of the Command design pattern [Gamma95, p.233].
dk.rode.thesis.composite Implementations and examples of the Composite design pattern [Gamma95, p.163].
dk.rode.thesis.decorator Implementations and examples of the Decorator design pattern [Gamma95, p.175].
dk.rode.thesis.facade Implementations and examples of the Facade design pattern [Gamma95, p.185].
dk.rode.thesis.factorymethod Implementations and examples of the Factory Method design pattern [Gamma95, p.107].
dk.rode.thesis.flyweight Implementations and examples of the Flyweight design pattern [Gamma95, p.195].
dk.rode.thesis.interpreter Implementations and examples of the Interpreter design pattern [Gamma95, p.243].
dk.rode.thesis.iterator Implementations and examples of the Iterator design pattern [Gamma95, p.257].
dk.rode.thesis.mediator Implementations and examples of the Mediator design pattern [Gamma95, p.273].
dk.rode.thesis.memento Implementations and examples of the Memento design pattern [Gamma95, p.283].
dk.rode.thesis.meta Defines annotations and enumerations corresponding to "Gang of Four" classifications and participants, as well as annotations used to annotate actual source code to identify pattern participants.
dk.rode.thesis.meta.log Defines the simple log model used throughout this project, including system out loggers and file loggers.
dk.rode.thesis.meta.model Defines the common model objects used, primarily sequences and various general implementations used in the different evaluations.
dk.rode.thesis.meta.reflect Various reflection utilities and classes.
dk.rode.thesis.meta.reflect.proxy Utilities to create dynamic proxies.
dk.rode.thesis.meta.test Various tests.
dk.rode.thesis.meta.util Various utility classes and functions.
dk.rode.thesis.observer Implementations and examples of the Observer design pattern [Gamma95, p.293].
dk.rode.thesis.prototype Implementations and examples of the Prototype design pattern [Gamma95, p.117].
dk.rode.thesis.proxy Implementations and examples of the Proxy design pattern [Gamma95, p.207].
dk.rode.thesis.singleton Implementations and examples of the Singleton design pattern [Gamma95, p.127].
dk.rode.thesis.state Implementations and examples of the State design pattern [Gamma95, p.305].
dk.rode.thesis.strategy Implementations and examples of the Strategy design pattern [Gamma95, p.315].
dk.rode.thesis.templatemethod Implementations and examples of the Template Method design pattern [Gamma95, p.325].
dk.rode.thesis.visitor Implementations and examples of the Visitor design pattern [Gamma95, p.331].

 

Abstract:
In this project, we perform an evaluation of the "Gang of Four" design patterns from a practical and experimental point of view using Java 6 as the implementation language. We investigate how Java 6 language features affect the application of the "Gang of Four" design patterns, individually and collectively. The investigation focuses on how the practical use of language features can affect the design pattern implementations, not how the features are constructed. To perform a reasonably structured and verifiable evaluation, we define a general evaluation approach on how to evaluate the "Gang of Four" patterns using a language as a catalyst. The premise is to implement all functionality described in Implementation and Sample Code elements in the "Gang of Four" pattern descriptions and evaluate the outcome, as these are the elements that primarily target the practical implementation.

Using the defined approach, we implement the "Gang of Four" patterns in Java 6 and investigate use of core language features (types, generics, closures, etc), reflection (class literals, dynamic proxies, annotations, etc), and special language mechanisms (synchronisation, serialization, cloning, etc). The individual pattern evaluations show that with a few exceptions, all pattern functionality, including Meta-information, described in the Implementation and Sample Code elements can be implemented or simulated in Java 6 using the investigated features. The comparative evaluation shows that Java's mixture of static and dynamic features are very well suited to express the "Gang of Four" pattern functionality. Creational and especially Behavioural patterns benefit from dynamic usage, while the static features make the implementations more robust and possibly reusable. The implementations furthermore provide novel, or at least alternative, approaches on how to implement Abstract Factory, Factory Method, Memento, Observer, Proxy, Singleton, and State in Java 6.


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.