Skip to content

rons1/DesignPatterns

Repository files navigation

DesignPatterns

Course

1 - Singleton

  • Useful when you want to create only one unstance of object from a class

2 - Factory

  • Faunction that generate and returns an object from the specified class

3 - State

  • An imlementation to a state machine

4 - Chain Of Responsibility

  • A set of objects that can pass a process throght a flow
  • Each object is handling only one step
  • The order of the steps is

5 - Composite

  • An implementation to containers and objects inside them
  • An implementation to trees, subtrees and leaves

6 - Prototype

  • Maked a deep Clone to an object

7 - Visitor

  • To combine an existing functionallity to many classes
  • To Add a new functionallity to many classes
  • Disadvantage: You will always have to update the IVisitor after you add new class
  • All the logic is implemented in the Visitor Class

8 - Adapter

  • Useful for an old code
  • Can be useful for a third party code

9 - Memento

  • Remineds Undo and Redo
  • You can save a state and return to it when you decide

10 - TemplateMethod

  • Useful for code reuse
  • Useful for running same code with minor changes each time
  • Useful when set of functions run every time

11 - Strategy

  • When you want to use Has-A instead of Is-A

12 - Decorator

  • When you want to modify an object many times, every time modify the most updated object

13 - Builder

  • When you want to manage a set of objects and create an object from that set

About

Course

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages