Coder Social home page Coder Social logo

hamzaak / designpatterns Goto Github PK

View Code? Open in Web Editor NEW
9.0 3.0 4.0 315 KB

Implementing design patterns (GoF) in .NET Core with real world applications.

License: MIT License

C# 100.00%
design-patterns dotnetcore gof-patterns observer-pattern singleton-pattern factory-pattern abstractfactorypattern facade-pattern builder-pattern chain-of-responsibility adapter-pattern strategy-pattern

designpatterns's Introduction

Image of Design Patterns

Design Patterns (GoF)

The four authors Erich Gamma, Richard Helm, Ralph Johnson and John Vlissides are collectively introduced Gang of Four Design Patterns in Software development. In 1994, they published a book (Design Patterns: Elements of Reusable Object-Oriented Software) for explaining the concept of Design Patterns

The 23 Design patterns are defined by the Gang of Four programmers. These 23 patterns are divided into three groups depending on the nature of the design problem they intend to solve.

This repo implements design patterns in .NET Core with real life examples.

1. Creational Design Patterns

These patterns deal with the process of objects creation in such a way that they can be decoupled from their implementing system. This provides more flexibility in deciding which objects need to be created for a given use case/ scenario. There are as follows:

  1. Factory Method: Create instances of derived classes.
  2. Abstract Factory: Create instances of several classes belonging to different families.
  3. Builder: Separates an object construction from its representation.
  4. Prototype: Create a duplicate object or clone of the object.
  5. Singleton: Ensures that a class can has only one instance.

2. Structural Design Patterns

These patterns deal with the composition of objects structures. The concept of inheritance is used to compose interfaces and define various ways to compose objects for obtaining new functionalities. There are as follows:

  1. Adapter: Match interfaces of different classes.
  2. Bridge: Separates an object’s abstraction from its implementation .
  3. Composite: A tree structure of simple and composite objects.
  4. Decorator: Add responsibilities to objects dynamically.
  5. Facade: A single class that represents an entire complex system.
  6. Flyweight: Minimize memory usage by sharing as much data as possible with similar objects.
  7. Proxy: Provides a surrogate object, which references to other object.

3. Behavioral Design Patterns

These patterns deal with the process of communication, managing relationships, and responsibilities between objects. There are as follows:

  1. Chain of Responsibility: Passes a request among a list or chain of objects.
  2. Command: Wraps a request under an object as a command and passed to invoker object.
  3. Interpreter: Implements an expression interface to interpret a particular context.
  4. Iterator: Provides a way to access the elements of a collection object in sequential manner without knowing its underlying structure.
  5. Mediator: Allows multiple objects to communicate with each other’s without knowing each other’s structure.
  6. Memento: Capture the current state of an object and store it in such a manner that it can be restored at a later time without breaking the rules of encapsulation.
  7. Observer: Allows an object (subject) to publish changes to its state and other objects (observer) that depend upon that object are automatically notified of any changes to the subject's state.
  8. State: Alters the behavior of an object when it’s internal state changes.
  9. Strategy: Allows a client to choose an algorithm from a family of algorithms at run-time and gives it a simple way to access it.
  10. Visitor: Creates and performs new operations onto a set of objects without changing the object structure or classes.
  11. Template Method: Defines the basic steps of an algorithm and allow the implementation of the individual steps to be changed.

License

MIT

designpatterns's People

Contributors

hamzaak avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.