Welcome to PerfectJPattern

PerfectJPattern is a framework and catalog of perfectionated and componentized Java Design Patterns. A componentized pattern is in essence a context-independent, reusable and type-safe variation of the original pattern that covers at least as many use-cases as the original pattern and that does not require developers to re-implement the same boilerplate code in every different context. Design Patterns are reusable in terms of design, componentized patterns are reusable in terms of design and code.

PerfectJPattern is inspired by the original work of Prof. Dr. Bertrand Meyer Trusted Components and Karine Arnout Thesis From Patterns to Components conceptually possible in any language but their work is tailored to the Eiffel programming language e.g. strongly relies on Eiffel's Agent mechanism and Eiffel's Design by Contract whereas there are no such features in Java. The Agent mechanism natively supported in Eiffel is equivalent to the Delegates Language feature, supported natively in other languages e.g. .NET C# but not in Java.

The term Component used all over PerfectJPattern is Prof. Dr. Bertrand Meyer's definition: "... a software component is a reusable software element, typically some library classes, usually in source form (not binary form), which differs from Clemens Szyperski's view of components." Meyer was already writing in 1997: "A successful pattern cannot just be a book description: it must be a software component".

Several advantages of relying on a library of componentized Design Patterns:

  • Developers are relieved from the burden of having to re-implement hence duplicate the same code over and over with only context-specific differences e.g. in the Observer Pattern the Subject implementation requires handling and iterating a collection of Observer instances.
  • Because Design Patterns are specified through descriptions, UML diagrams and non-reusable sample code; more often than not the ultimate developers' implementations are inexact, inefficient, defective or hardly reusable.
  • Design Patterns can be naturally combined to resolve specific design problems; relying on a Patterns Library will boost creating such combinations or even provide natural combinations out of the box e.g. Composite Commands.

Project Scope

The scope of this project is to build and offer to the Java community:

  • A foundation of reusable componentized version of all known Design Patterns including not only those from GoF but also others relevant to the Java platform e.g. Generic DAO implementation.
  • Pattern extensions and design gadgets e.g. a SynchronizedObserver proxy that would protect any Observer implementation from "race hazards" if notified concurrently from multiple Subjects notifying from separate threads.
  • Blueprints on top of the patterns catalog: designing applications as combinations of componentized design patterns assembled using an IoC container e.g. PicoContainer


Code Coverage by Clover
Chanve Vision, Inc.

I would like to thank:

  • Cenqua for providing a free license of Clover for generating test coverage reports.
  • yWorks for providing a free license of yDoc for automatically generating UML diagrams along with the Javadocs.
  • Chanve Vision, Inc. for providing a free license of JUDE Professional for creating top quality UML diagrams.
  • ej-technologies for providing a free license of JProfiler for efficiently resolving performance bottlenecks, memory leaks and threading issues.