Skip to content

This project contains many sample codes for demonstrating the usage of some common design patterns.

Notifications You must be signed in to change notification settings

MinhQuan992/design-patterns

Repository files navigation

STUDY COMMON DESIGN PATTERNS

1. About this project

This project contains many sample codes for demonstrating the usage of the following design patterns:

2. Reference

  • The problem in each module is from the book Head First Design Patterns, 2nd Edition by Eric Freeman and Elisabeth Robson.
  • The code, definitions, principles, and some diagrams in this project are referenced from that book.

3. Object-Oriented (OO) Design Principles

  • Encapsulate what varies.
  • Favor composition over inheritance.
  • Program to interfaces, not implementations.
  • Strive for loosely coupled designs between objects that interact.
  • Classes should be open for extension but closed for modification.
  • Depend upon abstractions. Do not depend upon concrete classes.
  • Principle of Least Knowledge: talk only to your immediate friends (see demonstrations here for more details).
  • The Hollywood Principle: don't call us, we'll call you (see demonstrations here for more details).
  • The Single Responsibility Principle: a class should have only one reason to change.

4. Pattern Categories

  • Creational patterns involve object instantiation and all provide a way to decouple a client from the objects it needs to instantiate:
    • Factory Method Pattern
    • Abstract Factory Pattern
    • Singleton Pattern
  • Any pattern that is a Behavioral Pattern is concerned with how classes and objects interact and distribute responsibility:
    • Strategy Pattern
    • Observer Pattern
    • Command Pattern
    • Template Method Pattern
    • Iterator Pattern
    • State Pattern
  • Structural patterns let you compose classes or objects into larger structures:
    • Decorator Pattern
    • Adapter Pattern
    • Facade Pattern
    • Composite Pattern
    • Proxy Pattern

About

This project contains many sample codes for demonstrating the usage of some common design patterns.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages