Skip to content

grand-rick/design-patterns

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Design Patterns 101

This repository is a collection of design patterns in object-oriented programming.

The repository is a work in progress and will be updated as I learn more about design patterns.

OO basics

  • Abstraction
  • Encapsulation
  • Polymorphism
  • Inheritance

OO Principles

  1. Encapsulate what varies
  2. Favor composition over inheritance
  3. Program to an interface, not an implementation
  4. Strive for loosely coupled designs between objects that interact
  5. Classes should be open for extension but closed for modification

Design Patterns

  1. Strategy Pattern

    • Define a family of algorithms, encapsulate each one, and make them interchangeable. Strategy lets the algorithm vary independently from clients that use it. Strategy Pattern Image
  2. Observer Pattern

    • Define a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically. Observer Pattern Image
  3. Decorator Pattern

    • Attach additional responsibilities to an object dynamically. Decorators provide a flexible alternative to subclassing for extending functionality. Decorator Pattern Image
  4. Factory Pattern

    • Define an interface for creating an object, but let subclasses decide which class to instantiate. Factory Method lets a class defer instantiation to subclasses. Factory Pattern Image

About

Learn about the fundamentals of design patterns

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published