Tearth / Design-Patterns

Collection of 23 Gang of Four design patterns implementations in C#.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Design Patterns

Collection of 23 Gang of Four design patterns implementations in C#. Done mainly for learning purposes but feel free to use them however you want.

Behavioral patterns

Define the ways of communication between objects.

  • Chain of Responsibility - handles data by passing it between objects in the chain
  • Command - encapsulates command/request into separate class
  • Interpreter - executes expressions
  • Iterator - sequental access to the elements in the collection
  • Mediator - communication between objects using separate class
  • Memento - saves and restores object state
  • Observer - notifies objects about some event
  • State - alters class behaviour
  • Strategy - encapsulates algorithms to the separate classes
  • Template Method - overrides (by creating subclasses) steps of the algorithm
  • Visitor - adds new operation to the class without its change

Creational patterns

Define the ways of creating objects using hidden logic instead of directly new keyword use.

  • Abstract Factory - creates instances of the specified class family
  • Builder - constructs instances with a few steps
  • Factory Method - creates instances of the derived classes
  • Prototype - creates instance by copying or cloning other object
  • Singleton - ensures that there is only one instance of the class

Structural patterns

Define the ways of composing objects and classes to add or change functionality.

  • Adapter - matches interfaces of different classes
  • Bridge - separates interface from its implementation
  • Composite - composes object using tree structure
  • Decorator - adds new responsibilities to the existing class
  • Facade - class representing a few subsystems
  • Flyweight - small and reusable objects
  • Proxy - controlls the access to the object

About

Collection of 23 Gang of Four design patterns implementations in C#.

License:GNU General Public License v3.0


Languages

Language:C# 100.0%