Design pattern is a general design that anyone can apply which resolves the goal and set of constraints that occur in recurring situation while designing the programming for software.

Luckily, patterns are not described and documented as a simple problem and solution. We have much better ways of describing patterns and collecting them together into pattern catalogs.

Organizing Design Patterns

As the number of discovered Design Patterns grows, it makes sense to partition them into classification so that we can organize them, narrow our searches to subset of all Design Patterns.

In most catalogs, you will find patterns grouped into one of a few classification schemes. The must well known scheme was used by the first pattern catalog and partitions patterns into three distinct categories based on their purpose,

  1. Creational Patterns
  2. Behavioral Patterns
  3. Structural Patterns

Creational Patterns

Creational patterns involves object instantiation and all provide a way to decouple a client from the objects it needs to instantiate.

  • Abstract Factory pattern: a class requests the objects it requires from a factory object instead of creating the objects directly
  • Factory method pattern: centralize creation of an object of a specific type choosing one of several implementations
  • Builder pattern: separate the construction of a complex object from its representation so that the same construction process can create different representations
  • Dependency Injection pattern: a class accepts the objects it requires from an injector instead of creating the objects directly
  • Lazy initialization pattern: tactic of delaying the creation of an object, the calculation of a value, or some other expensive process until the first time it is needed
  • Object pool pattern: avoid expensive acquisition and release of resources by recycling objects that are no longer in use
  • Prototype pattern: used when the type of objects to create is determined by a prototypical instance, which is cloned to produce new objects
  • Singleton pattern: restrict instantiation of a class to one object

Behavioral Pattern

Any pattern that is a Behavioral Pattern is concerned with how classes and objects interact and distribute responsibility

  • Blackboard design pattern: provides a computational framework for the design and implementation of systems that integrate large and diverse specialized modules, and implement complex, non-deterministic control strategies
  • Chain of responsibility pattern: Command objects are handled or passed on to other objects by logic-containing processing objects
  • Command pattern: Command objects encapsulate an action and its parameters
  • Interpreter pattern: Implement a specialized computer language to rapidly solve a specific set of problems
  • Iterator pattern: Iterators are used to access the elements of an aggregate object sequentially without exposing its underlying representation
  • Mediator pattern: Provides a unified interface to a set of interfaces in a subsystem
  • Memento pattern: Provides the ability to restore an object to its previous state (rollback)
  • Null object pattern: Designed to act as a default value of an object
  • Observer pattern: Objects register to observe an event that may be raised by another object
  • Scheduled-task pattern: A task is scheduled to be performed at a particular interval or clock time (used in real-time computing)
  • Single-serving visitor pattern: Optimise the implementation of a visitor that is allocated, used only once, and then deleted
  • Specification pattern: Recombinable business logic in a boolean fashion
  • State pattern: A clean way for an object to partially change its type at runtime
  • Strategy pattern: Algorithms can be selected on the fly, using composition
  • Template method pattern: Describes the program skeleton of a program; algorithms can be selected on the fly, using inheritance
  • Visitor pattern: A way to separate an algorithm from an object

Structural Pattern

Structural Patterns let you compose classes or objects into larger structures

  • Adapter pattern: ‘adapts’ one interface for a class into one that a client expects
  • Aggregate pattern: a version of the Composite pattern with methods for aggregation of children
  • Bridge pattern: decouple an abstraction from its implementation so that the two can vary independently
  • Composite pattern: a tree structure of objects where every object has the same interface
  • Decorator pattern: add additional functionality to a class at runtime where subclassing would result in an exponential rise of new classes
  • Extensibility pattern: a.k.a. Framework – hide complex code behind a simple interface
  • Facade pattern: create a simplified interface of an existing interface to ease usage for common tasks
  • Flyweight pattern: a large quantity of objects share a common properties object to save space
  • Marker pattern: an empty interface to associate metadata with a class.
  • Pipes and filters: a chain of processes where the output of each process is the input of the next
  • Opaque pointer: a pointer to an undeclared or private type, to hide implementation details
  • Proxy pattern: a class functioning as an interface to another thing

Conclusion

We saw about design patterns and its categories.

Please follow and like us: