A collection of design & application patterns for Go language.
Creational Patterns
Pattern |
Description |
Status |
Factory |
Provides an interface for creating families of releated objects |
✔ |
Abstract Factory |
Provides an interface for creating families of releated objects |
✔ |
Singleton |
Restricts instantiation of a type to one object |
✔ |
Builder |
Builds a complex object using simple objects |
✔ |
Prototype |
Instantiates and maintains a group of objects instances of the same type |
✔ |
Structural Patterns
Pattern |
Description |
Status |
Adapter |
|
✔ |
Bridge |
Decouples an interface from its implementation so that the two can vary independently |
✔ |
Filter |
|
✔ |
Composite |
Encapsulates and provides access to a number of different objects |
✔ |
Decorator |
Adds behavior to an object, statically or dynamically |
✔ |
Facade |
Uses one type as an API to a number of others |
✔ |
Flyweight |
Reuses existing instances of objects with similar/identical state to minimize resource usage |
✔ |
Proxy |
Provides a surrogate for an object to control it's actions |
✔ |
Behavioral Patterns
Pattern |
Description |
Status |
Chain of Responsibility |
Avoids coupling a sender to receiver by giving more than object a chance to handle the request |
✔ |
Command |
Bundles a command and arguments to call later |
✔ |
Interpreter |
interpreter |
✔ |
Mediator |
Connects objects and acts as a proxy |
✔ |
Memento |
Generate an opaque token that can be used to go back to a previous state |
✔ |
Observer |
Provide a callback for notification of events/changes to data |
✔ |
State |
Encapsulates varying behavior for the same object based on its internal state |
✔ |
Strategy |
Enables an algorithm's behavior to be selected at runtime |
✔ |
Template |
Defines a skeleton class which defers some methods to subclasses |
✔ |
Visitor |
Separates an algorithm from an object on which it operates |
✔ |
refer:
http://www.runoob.com/design-pattern/