Design Pattern Note

Someday, I will use them. They are not so simple just as what they seem like.

Observer Pattern

Publishers + Subscribers = Oberver Pattern


The Observer Pattern defines a one-to-many dependency between objects so that when one object changes state, all of its dependents are notified an updated automatically.

Java built-in support: java.util.Observerable / java.util.Observer

Decorator Pattern

The Decorator Pattern attaches additional responsibilities to an object dynamically. Decorators provide a flexible alternative to subclassing for extending functionality.

Factory Pattern

The Factory Method Pattern defines an interface for creating an object, but lets subclasses decide which class to instantiate. Factory Method lets a class defer instantiation to subclasses.