Skip to content

Latest commit

 

History

History
72 lines (41 loc) · 4.59 KB

README.md

File metadata and controls

72 lines (41 loc) · 4.59 KB

Design Patterns

HttpPatch

The project includes examples of implementation of Design Patterns by GOF using C# and UML diagrams

Design Patterns can be classified into three categories namely - Creational patterns - Structural patterns - Behavioral patterns

  1. Creational design patterns
  • are design patterns that deal with object creation mechanisms, trying to create objects in a manner suitable to the situation.

  • creational patterns consists of five design patterns

    • Abstract factory - which provides an interface for creating related or dependent objects without specifying the objects' concrete classes

    • Builder - separate the construction of a complex object from its representation so that the same construction process can create different representations

    • Factory method - centralize creation of an object of a specific type choosing one of several implementations

    • Singleton - restrict instantiation of a class to one object

    • Prototype - used when the type of objects to create is determined by a prototypical instance, which is cloned to produce new objects

  1. Structural design patterns
  • are design patterns that ease the design by identifying a simple way to realize relationships between entities.

  • examples of structural design patters includes the following

    • Adapter - match interfaces of different classes or 'adapts' one interface for a class into one that a client expects

    • Bridge - decouple an abstraction from its implementation so that the two can vary independently

    • Composite - a tree structure of objects where every object has the same interface

    • Decorator - add additional functionality to a class at runtime where subclassing would result in an exponential rise of new classes

    • Facade - create a simplified interface of an existing interface to ease usage for common tasks

    • Flyweight - a large quantity of objects share a common properties object to save space

    • Proxy - An object representing another object or a class functioning as an interface to something else

  1. Behavioral design patterns
  • are design patterns that identify common communication patterns between objects and realize these patterns.

  • examples of behavioral design patterns comprise of the following

    • Chain of Responsibility - command objects are handled or passed on to other objects by logic-containing processing objects

    • Commmand - command objects encapsulate an action and its parameters

    • Interpreter - a way to include language elements in a program

    • Iterator - iterators are used to access the elements of an aggregate object sequentially without exposing its underlying representation

    • Mediator - provides a unified interface to a set of interfaces in a subsystem

    • Memento - provides the ability to restore an object to its previous state (rollback)

    • Observer - objects register to observe an event that may be raised by another object

    • State - a clean way for an object to partially change its type at runtime

    • Strategy - algorithms can be selected on the fly

    • Template method - defer the exact steps of an algorithm to a subclass

    • Visitor - a way to separate an algorithm from an object