Skip to content

0x41gawor/design-patterns

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Design Patterns

source

Design patterns are typical solutions to commonly occurring problems in software design. They are like pre-made blueprints that you can customize to solve a recurring design problem in your code.

You can’t just find a pattern and copy it into your program, the way you can with off-the-shelf functions or libraries. The pattern is not a specific piece of code, but a general concept for solving a particular problem. You can follow the pattern details and implement a solution that suits the realities of your own program.

Classification of patterns

Creational Patterns

These patterns provide various object creation mechanisms, which increase flexibility and reuse of existing code.

  • Factory Method
  • Builder
  • Singleton
  • Abstract Factory
  • Prototype

Structural Patterns

These patterns explain how to assemble objects and classes into larger structures while keeping these structures flexible and efficient.

  • Adapter
  • Bridge
  • Composite
  • Decorator
  • Facade
  • Flyweight
  • Proxy

Behavioral Patterns

These patterns are concerned with algorithms and the assignment of responsibilities between objects.

  • Chain of resposibility
  • Command
  • Iterator
  • Mediator
  • Memento
  • Observer
  • State
  • Strategy
  • Template Method
  • Visitor

Commits in this repo

Each commit will represent another design pattern.

Idea is to commit once a day everyday through 22 days.

Each commit will include:

  • Code example in src/
  • doc.md - about current design pattern
  • img/ - image files for doc.md
  • this very file (design_patterns.md)

commit names

Each commit concerns one design pattern so:

<name.toUpper()> (<group>)

For example:

BUILDER (Creational Pattern)

sequence

Sequence is based on popularity and my desire to learn concrete design pattern:

  • FACTORY METHOD (Creational Pattern)
  • DECORATOR (Structural Pattern)
  • OBSERVER (Behavioral Pattern)
  • SINGLETON (Creational Pattern)
  • STATE (Behavioral Pattern)
  • ADAPTER (Structural Pattern)
  • STRATEGY (Behavioral Pattern)
  • BUILDER (Creational Pattern)
  • COMMAND (Behavioral Pattern)
  • CHAIN OF RESPONSIBILITY (Behavioral Pattern)
  • PROTOTYPE (Creational Pattern)
  • TEMPLATE METHOD (Behavioral Pattern)
  • PROXY (Structural Pattern)
  • ITERATOR (Behavioral Pattern)
  • BRIDGE (Structural Pattern)
  • ABSTRACT FACTORY (Creational Pattern)
  • MEDIATOR (Behavioral Pattern)
  • FACADE (Structural Pattern)
  • MEMENTO (Behavioral Pattern)
  • COMPOSITE (Structural Pattern)
  • VISITOR (Behavioral Pattern)
  • FLYWEIGHT (Structural Pattern)