← All writing

Java

Top Design Patterns in Java

A reference to common design patterns and examples of their use in Java.

1 view Copy this article’s link to your clipboard.
  1. Singleton - Ensures one instance, global access (e.g., Runtime).
  2. Factory Method - Creates objects via subclasses (e.g., Calendar.getInstance()).
  3. Abstract Factory - Creates families of related objects (e.g., GUI themes).
  4. Builder - Constructs complex objects step-by-step (e.g., StringBuilder).
  5. Prototype - Clones objects for efficiency (e.g., Object.clone()).
  6. Adapter - Bridges incompatible interfaces (e.g., InputStreamReader).
  7. Decorator - Dynamically adds responsibilities (e.g., BufferedReader).
  8. Facade - Simplifies complex subsystems (e.g., FacesContext).
  9. Composite - Represents part-whole hierarchies (e.g., java.awt.Component).
  10. Proxy - Controls object access (e.g., RMI, Spring AOP).
  11. Observer - Notifies dependents of state changes (e.g., JavaFX properties).
  12. Strategy - Encapsulates interchangeable algorithms (e.g., Comparator).
  13. Command - Encapsulates requests as objects (e.g., Runnable).
  14. Template Method - Defines algorithm skeletons (e.g., HttpServlet).
  15. Chain of Responsibility - Passes requests along handlers (e.g., Servlet filters).
More articles →