Design Patterns

15 Jun 2021

A simple overview of coding Design Patterns, described originally by the Gang of Four, which support better code quality through the use of well-defined purpose driven components

1. CREATION Abstract Factory

Used to create concrete instances of specific types, via context, without directly accessing a specific factory type

Abstract Factory

2. STRUCTURE Adapter

The implementation of consistent interfaces to support classes to interact, which otherwise implement incompatible interfaces

Adapter

3. CREATION Builder

Enforces separation of concerns by separating the code responsible for building a type, from the implementation of the type

Builder

4. STRUCTURE Bridge

A structural separation of an object’s definition (interface) from its implementation

Bridge

5. BEHAVIOR Chain of Responsibility

A structure which supports decoupling the receiver from the requester by permitting a series of types determine in sequence which receiver should handle a message request

Chain of Responsibility

6. STRUCTURE Composite

A structure pattern which permits the uniform treatment of a type, or a collection of types, such that the knowledge of the number of type instances being managed is irrelevant to the calling manager

Composite

7. BEHAVIOR Command

A messaging pattern which allows all individual requests to be treated as objects, and thereby permit the storage, execution, and reversal of execution of command requests to be implemented

Command

8. STRUCTURE Decorator

A mechanism by which dynamic features and behaviors are added to an existing type

Decorator

9. STRUCTURE Facade

A type which obscures and abstracts the complexity of the underlying subsystem, so to enforce use of the facade rather than the subsystem

Facade

10. STRUCTURE Factory Method

Support the creation of objects using a well defined interface, but defer the implementation to specific concrete subclasses, which create specific type instances

Factory Method

11. STRUCTURE Flyweight

A type which is purpose built to be shared, containing the minimum members to represent the types in its specific shared use case

Flyweight

12. BEHAVIOR Interpreter

A lexical grammar of expressions which form a language and the support to parse expressions which conform to the language

Interpreter

13. BEHAVIOR Iterator

A means to sequentially access and interpret members of a collection, generically without needing to understand the type

Iterator

14. BEHAVIOR Mediator

Decouples types from one another, by using a intermediary type through which communication is invoked

Mediator

15. BEHAVIOR Memento

A type which is designed to store state, as a sufficient representation of another type such that the type to be represented can be recovered as required

Memento

16. BEHAVIOR Observer

A communication pattern which distributes a signal from a single type to an arbitrary number of related types, when the original type instance is modified, so that the related types can react to the change

Observer

17. CREATION Prototype

A means to create fully-implemented duplicates of concrete types, of the same type and internal state

Prototype

18. STRUCTURE Proxy

A type which has the member data and requisite permission set to act on behalf of another type

Proxy

19. BEHAVIOR State

A behavior pattern which allows the behavior of a type externally determined by the internal state of the instance type

State

20. BEHAVIOR Strategy

A pattern which supports many alternative implementations of an interface, to permit choice in the implementation and thereby select its desired behavior

Strategy

21. CREATION Singleton

A mechanism to enforce the reuse of a single instance of a type

Singleton

22. BEHAVIOR Template Method

A pattern whereby an algorithm is defined, but the implementation of the algorithm’s steps may be redefined and extended, without changing the original algorithms structure

Template Method

23. BEHAVIOR Visitor

An object type which iterates over a collection, performing the same operation on each item in the collection

Visitor

Acknowledgements