Skip to content

ProgrammingLessons/DesignPatterns

Repository files navigation

Design Patterns

Design Patterns are solutions created for common problems in software. They can be thought of as pre-made plans that can be customized and used to solve common problems in code. Design patterns are general concepts used for problem solving, not parts that can be found ready-made, such as a function or class, and added to the code.

Factory Design Pattern

Factory Design Pattern requires designing an interface for object creation and allows subclasses to produce objects. In addition, the subclasses themselves determine which class object will be created. Thus it abstracts the object creation process. It is one of the creative design patterns and is frequently used in software.

See Example


Abstract Factory Design Pattern

Abstract Factory is a creational design pattern, which solves the problem of creating entire product families without specifying their concrete classes. Abstract Factory defines an interface for creating all distinct products but leaves the actual product creation to concrete factory classes. Each factory type corresponds to a certain product variety.

See Example


Singleton Design Pattern

A singleton is used to ensure that there is only one instance of an object and that the same (and only one instance) is called everywhere in your code whenever you need that object.

See Example


Composite Design Pattern

Composite is a structural design pattern that allows composing objects into a tree-like structure and work with the it as if it was a singular object.

See Example


Decorator Design Pattern

Decorator pattern allows a user to add new functionality to an existing object without altering its structure. This type of design pattern comes under structural pattern as this pattern acts as a wrapper to existing class.

This pattern creates a decorator class which wraps the original class and provides additional functionality keeping class methods signature intact.

See Example


Chain Of Responsibility Design Pattern

Chain of Responsibility is a behavioral design pattern that allows you to pass requests along a chain of handlers. After receiving a request, each handler decides to process the request or forward it to the next handler in the chain.

See Example


Command Design Pattern

Command is a behavioral design pattern that turns a request into a stand-alone object that contains all information about the request. This transformation lets you pass requests as a method arguments, delay or queue a request’s execution, and support undoable operations.

See Example


Mediator Design Pattern

Mediator is a behavioral design pattern that lets you reduce chaotic dependencies between objects. The pattern restricts direct communications between the objects and forces them to collaborate only via a mediator object.

See Example


Strategy Design Pattern

Strategy is a behavioral design pattern that turns a set of behaviors into objects and makes them interchangeable inside original context object.

See Example


Visitor Design Pattern

Visitor is a behavioral design pattern that lets you separate algorithms from the objects on which they operate.

See Example


Proxy Design Pattern

Proxy is a structural design pattern that lets you provide a substitute or placeholder for another object. A proxy controls access to the original object, allowing you to perform something either before or after the request gets through to the original object.

See Example

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages