This repository contains implementations of various design patterns. Below is a list of the design patterns included in this project:
-
Chain of Responsibility
- Allows an object to pass a request along a chain of potential handlers until the request is handled.
-
Command
- Encapsulates a request as an object, allowing parameterization of clients with queues, requests, and operations.
-
Iterator
- Provides a way to access the elements of an aggregate object sequentially without exposing its underlying representation.
-
Mediator
- Defines an object that encapsulates how a set of objects interact, promoting loose coupling by keeping objects from referring to each other explicitly.
-
Memento
- Captures and externalizes an object's internal state so that the object can be restored to this state later without violating encapsulation.
-
Observer
- Defines a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically.
-
State
- Allows an object to alter its behavior when its internal state changes, appearing to change its class.
-
Strategy
- Defines a family of algorithms, encapsulates each one, and makes them interchangeable, allowing the algorithm to vary independently from clients that use it.
-
Template Method
- Defines the skeleton of an algorithm in a method, deferring some steps to subclasses, allowing them to redefine certain steps without changing the algorithm's structure.
-
Visitor
- Represents an operation to be performed on elements of an object structure, allowing new operations to be defined without changing the classes of the elements on which it operates.
Each pattern is implemented with clear and concise examples to demonstrate its usage and benefits. Feel free to explore and use these patterns in your own projects.