Design Patterns From Zero To Hero
Design Patterns From Zero To Hero
ZERO TO HERO
Atanas Vasilev
LinkedIn: https://www.linkedin.com/in/atanas-vasilev-it/
GitHub: https://github.com/NaskoVasilev
Demo Code Link: https://
github.com/NaskoVasilev/Design-Patterns
TABLE OF CONTENTS
• Introduction
• Groups of design patterns
• Creational
• Structural
• Behavioral
• Dive into design patterns one by one
• Theory
• Real world example
• Link to detailed article
• Demo
HAVE A QUESTION?
sli.do
#DesignPatterns
ABOUT ME
• Software engineer
• Full-stack developer in SoftUni Dev team
• Laureate of the National Olympiad in Information Technology
• C# and JS tracks in SoftUni
• Studying Software engineering at FMI in Sofia University (second year)
• Take part in a lot of Information Technology contests
• Started learning programming at the age of 14
WHAT ARE DESIGN PATTERNS?
• Abstract Factory
• Builder
• Factory Method
• Factory
• Prototype
• Singleton
SINGLETON(1)
• Ensure that a class has only one instance
• https://refactoring.guru/design-patterns/singleton
• https://github.com/NaskoVasilev/Design-Patterns/tree/master/CreationalPatterns/Singleton
SINGLETON(2)
ABSTRACT FACTORY(1)
• Produce families of related objects without specifying their concrete classes
• https://refactoring.guru/design-patterns/abstract-factory
• https://github.com/NaskoVasilev/Design-Patterns/tree/master/CreationalPatterns/AbstractFactory
ABSTRACT FACTORY(2)
BUILDER(1)
• Adapter
• Bridge
• Composite
• Decorator
• Façade
• Flyweight
• Proxy
ADAPTER(1)
• Allows objects with incompatible interfaces to collaborate
• https://refactoring.guru/design-patterns/adapter
• https://github.com/NaskoVasilev/Design-Patterns/tree/master/StructuralPatterns/Adapter
ADAPTER(2)
DECORATOR(1)
• Attach new behaviors to objects by placing these objects inside special wrapper
objects that contain the behaviors
• https://refactoring.guru/design-patterns/decorator
• https://
github.com/NaskoVasilev/Design-Patterns/tree/master/StructuralPatterns/Decor
ator
DECORATOR(2)
FAÇADE(1)
• Split a large class or a set of closely related classes into two separate hierarchies -
abstraction and implementation - which can be developed independently of each other
• https://github.com/NaskoVasilev/Design-Patterns/tree/master/StructuralPatterns/Bridge
• https://refactoring.guru/design-patterns/bridge
COMPOSITE
• Chain Of Responsibility
• Command
• Interpreter
• Iterator
• Mediator
• Memento
LIST OF BEHAVIORAL DESIGN PATTERNS(2)
• Observer
• State
• Strategy
• Template Method
• Visitor
ITERATOR(1)
• Lets you traverse elements of a collection without exposing its underlying representation
• https://refactoring.guru/design-patterns/iterator
• https://github.com/NaskoVasilev/Design-Patterns/tree/master/BehavioralPatterns/Iterator
ITERATOR(2)
CHAIN OF RESPONSIBILITY(1)
• Turns a request into a stand-alone object that contains all information about
the request
• Can pass requests as a method arguments, delay or queue a request’s execution
• https://refactoring.guru/design-patterns/command
• https://
github.com/NaskoVasilev/Design-Patterns/tree/master/BehavioralPatterns/Com
mand
MEMENTO
• Lets an object alter its behavior when its internal state changes
• https://refactoring.guru/design-patterns/state
• https://
github.com/NaskoVasilev/Design-Patterns/tree/master/BehavioralPatterns/St
ate
STRATEGY
• Define a family of algorithms, put each of them into a separate class, and
make their objects interchangeable
• https://refactoring.guru/design-patterns/strategy
• https://
github.com/NaskoVasilev/Design-Patterns/tree/master/BehavioralPatterns/Str
ategy
TEMPLATE METHOD