Java Design Patterns - iluwatar
Massive GitHub repository with Java implementations of all 23 GoF design patterns plus enterprise, functional, and architectural patterns.
Summary
This repository is one of the most-starred Java open-source projects, providing complete Java implementations of every Gang of Four pattern alongside enterprise, functional, and architectural patterns. Each pattern entry includes a UML class diagram showing structural relationships, real-world applicability notes explaining when to apply the pattern, a working code example, and description of use-case context.
The scope extends well beyond classic GoF to include enterprise integration patterns (Repository, Unit of Work, Data Mapper), functional patterns (Monad, Builder with lambda), and architectural patterns (Hexagonal, CQRS, Event Sourcing, Saga). This breadth makes it a comprehensive pattern reference for Java practitioners across all abstraction levels.
The UML diagrams are particularly valuable for understanding structural relationships between participants in each pattern. The applicability notes help practitioners make appropriate pattern selection decisions rather than applying patterns indiscriminately.
Key Arguments
- GoF patterns are language-agnostic principles that each language implements idiomatically
- Java implementations show how abstract patterns translate to a statically-typed OOP language
- UML diagrams clarify the structural relationships between pattern participants
- Real-world applicability notes help practitioners decide when (and when not) to use each pattern
- The repository extends beyond GoF to enterprise and architectural patterns, increasing practical coverage
Concepts Covered
- Design Patterns Overview — Java reference implementations for all major patterns
- Creational Patterns Overview — Factory, Abstract Factory, Builder, Singleton, Prototype in Java
- Structural Patterns Overview — Adapter, Bridge, Composite, Decorator, Facade, Flyweight, Proxy in Java
- Behavioral Patterns Overview — Observer, Strategy, Command, Iterator, Template Method, and others in Java
Quality Notes
Authoritative Java pattern reference. One of the most-starred Java open-source repositories. Particularly useful for practitioners who learn better from concrete code than from prose descriptions. Maintained actively with modern Java versions.