Summarising key patterns used in development for reference.
A Pattern is a solution to a problem in a context.
An Anti-Pattern tells you how to go from problem to a bad situation.
The Observer Pattern defines a one-to-many dependency between objects so that when one object changes state, all of its dependents are notified and updated automatically.
The Adapter Pattern converts the interface of a class into another interface the clients expect. Adapter lets classes work together that couldn’t otherwise because of incompatible interfaces.
Use Bridge Pattern to vary not only your implementation, but also your abstraction.
Use Builder Pattern to encapsulate the construction of a product and allow it to be constructed in steps. It encapsulates the way a complex object is created.
Use Chain of Responsibility Pattern when you want to give more than one object a chance to handle a request.
The Composite Pattern allows you to compose objects into tree structures to represent part-whole hierarchies. It lets clients treat individual objects and composition of objects uniformly.
The Command Pattern encapsulates the request as an object, thereby letting you parameterise other objects with different requests, queue or log requests, and support undoable operations.
The Decorator Pattern attaches additional responsibilities to an object dynamically. It provides a flexible alternative to subclassing for extending functionality.
The Facade Pattern provides a unified interface to a set of interfaces in a subsystem. It defines a higher level interface that makes the subsystem easier to use.
The Factory Method Pattern defines an interface for creating an object, but lets subclasses decide which classes to instantiate. Factory Method lets a class defer instantiation to subclasses.
Use the Flyweight Pattern when one instance of a class can be used to provide many “virtual instances”.
Use Interpreter Pattern to build an interpreter for a simple language.
The Iterator Pattern provides a way to access the elements of an aggregate object sequentially without exposing its underlying representation.
Use the Mediator Pattern to centralise complex communications and controls between related objects. It can become overly complex without proper design.
Use the Memento Pattern when you need to be able to return an object to one of its previous states, e.g. if your user requests an “undo”.
Use the Prototype Pattern when creating an instance of a given class is either expensive or complicated.
The Proxy Pattern provides a surrogate or placeholder for another object to control access to it.
The Singleton Pattern ensures a class has only one instance, and provides a global point of access to it.
The State Pattern allows an object to alter its behaviour when its internal state changes. The object will appear to change its class.
The Strategy Pattern defines a family of algorithms, encapsulates each one, and makes them interchangeable. Strategy lets the algorithm vary independently from clients that use it.
The Template Method Pattern defines the skeleton of an algorithm in a method, deferring some steps to subclasses. It lets subclasses redefine certain steps of an algorithm without changing the algorithm’s structure.
Use the Visitor Pattern when you want to add capabilities to a composite of objects and encapsulation is not important.
Please refer http://c2.com/ppr/ for more on patterns.
A Pattern is a solution to a problem in a context.
An Anti-Pattern tells you how to go from problem to a bad situation.
The Observer Pattern defines a one-to-many dependency between objects so that when one object changes state, all of its dependents are notified and updated automatically.
The Adapter Pattern converts the interface of a class into another interface the clients expect. Adapter lets classes work together that couldn’t otherwise because of incompatible interfaces.
Use Bridge Pattern to vary not only your implementation, but also your abstraction.
Use Builder Pattern to encapsulate the construction of a product and allow it to be constructed in steps. It encapsulates the way a complex object is created.
Use Chain of Responsibility Pattern when you want to give more than one object a chance to handle a request.
The Composite Pattern allows you to compose objects into tree structures to represent part-whole hierarchies. It lets clients treat individual objects and composition of objects uniformly.
The Command Pattern encapsulates the request as an object, thereby letting you parameterise other objects with different requests, queue or log requests, and support undoable operations.
The Decorator Pattern attaches additional responsibilities to an object dynamically. It provides a flexible alternative to subclassing for extending functionality.
The Facade Pattern provides a unified interface to a set of interfaces in a subsystem. It defines a higher level interface that makes the subsystem easier to use.
The Factory Method Pattern defines an interface for creating an object, but lets subclasses decide which classes to instantiate. Factory Method lets a class defer instantiation to subclasses.
Use the Flyweight Pattern when one instance of a class can be used to provide many “virtual instances”.
Use Interpreter Pattern to build an interpreter for a simple language.
The Iterator Pattern provides a way to access the elements of an aggregate object sequentially without exposing its underlying representation.
Use the Mediator Pattern to centralise complex communications and controls between related objects. It can become overly complex without proper design.
Use the Memento Pattern when you need to be able to return an object to one of its previous states, e.g. if your user requests an “undo”.
Use the Prototype Pattern when creating an instance of a given class is either expensive or complicated.
The Proxy Pattern provides a surrogate or placeholder for another object to control access to it.
The Singleton Pattern ensures a class has only one instance, and provides a global point of access to it.
The State Pattern allows an object to alter its behaviour when its internal state changes. The object will appear to change its class.
The Strategy Pattern defines a family of algorithms, encapsulates each one, and makes them interchangeable. Strategy lets the algorithm vary independently from clients that use it.
The Template Method Pattern defines the skeleton of an algorithm in a method, deferring some steps to subclasses. It lets subclasses redefine certain steps of an algorithm without changing the algorithm’s structure.
Use the Visitor Pattern when you want to add capabilities to a composite of objects and encapsulation is not important.
Please refer http://c2.com/ppr/ for more on patterns.