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

Master's Thesis, Computer Science



This is the homepage for my Master's Thesis Evaluating Software Design Patterns — the "Gang of Four" patterns implemented in Java 6. Thesis keywords include Design Patterns; "Gang of Four"; Java 6; Object—Orientation (OO); and (impact of) Language Features. The thesis is written in UK English, and to tease your interest, the abstract and a few high—lights are presented below. The thesis is logically devided into two parts: 1) background and theory; and 2) implementation and evaluation. Emphasis is on the practical implementation and evaluation, which investigates how the "Gang of Four" patterns and Java 6 (can) interact.

Gunni at the oral defence of the thesis on November 2nd, 2007The thesis and developed source code is freely available for download for those interested. The presentation given at the oral defence and UML class diagrams of the individual pattern implementations are also available for download. The thesis can also be browsed online, as well as the generated JavaDoc.

The picture to the right is me at the oral defence of the thesis given on November 2nd, 2007, at the Department of Computer Science, University of Copenhagen. Fabulous facilities, as you can see... :)

The thesis and source code are given a few small updates from time to time, e.g. because of errors or bugs, but note that no change—log/repository is kept! The topics covered in the thesis are by no means rocket science, and every programmer seems to have an opinion about OO and design patterns. You are - no doubt - no different. Therefore, feel free to drop a comment, sour grape, pad on the shoulder, question, report a bug or error, etc. However, I can promise that general and/or unconstructive bashing will be ignored! :) Click on my name below for email address, and put something meaningful like thesis or the thesis title in the subject to avoid my very aggressive spam filter. That is it. Enjoy & regards.

Gunni Rode
January 2008


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 pattern functionality described in Implementation and Sample Code elements in the "Gang of Four" pattern descriptions, as these are the elements that primarily target the practical implementation, and evaluate the outcome.

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 described in the Implementation and Sample Code elements, including Meta—information, 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, possibly reusable, and clarify pattern intent. 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.


Section 9.3 in the thesis is dedicated to the identified thesis high—lights; they pretty much revolve around the patterns listed in the abstract above. In addition, a couple of small classes/components/ideas deserve special mention as well. Hence, I hope the following list will peak your interest:


The thesis is available for download as a pdf file, or it can be browsed online in an HTML version.

Compared to the pdf version, the HTML version is more interactive and links directly to the generated JavaDoc for source code references. It also contains additional indexes, such as a list of pattern references in the text, as well as a few extra paragraphs of text here and there.

Source CodeSource Code

The main IDE (and compiler) used is Eclipse 3.3. The source code is written in Java 6, but will also compile using Java 5 with minor changes. See section 6.1 in the thesis for further details.

The source code is available for download, but note the ubiquitous license terms.


The source code is fully documented using JavaDoc, including all non-public members. The generated documentation can be browsed online, can be downloaded, and is also referenced directly from the online version of the thesis.

The JavaDoc is sometimes quite verbose, especially package documentation, and discusses issues not necessarily covered in the thesis. It is recommended to keep it close while reading the thesis, in particularly the evaluation part starting from chapter 5.


The following files are freely available for download, but note the license terms for the source code:

License TermsLicense Terms

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.