Skip to content

edwinvanderven/Design-Patterns-examples

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

80 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Design Patterns examples

Various implementations of different design patterns.

Introduction

This repository is my attempt to make sense of different design patterns, including tangible examples.
Every design pattern and code examples will be located into its own subfolder.

Code Examples

ℹ️ Make sure to have Node and NPM installed.

Inside a terminal run the following commands

npm install -g typescript
npm install -g ts-node

Inside a terminal, navigate to the folder with the code example and run the following command

ts-node index.ts

Design Patterns

Creational Structural Behavioral
Abstract Factory Adapter Chain of Responsibility
Builder Bridge Command
Factory Method Composite Interpreter
Prototype Decorator Iterator
Singleton Facade Mediator
Flyweight Memento
Proxy Observer
State
Strategy
Template
Visitor

Design Principles

Design principles are not patterns but can be used as mental reminders when designing software.

  • 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.
  • The Least amount of Knowledge; Only talk to your immediate friends.
  • Don’t call us, we’ll call you.
  • A class should have only one reason to change.

Sources

Releases

No releases published

Packages

No packages published