This project is a collection of practical examples and code implementations of popular Design Patterns, based on the content provided by Refactoring.Guru. The goal is to serve as a learning and reference resource for developers who want to understand and apply design patterns in real-world scenarios.
These patterns deal with object creation mechanisms, trying to create objects in a manner suitable to the situation.
-
Singleton
Ensures a class has only one instance and provides a global point of access to it. -
Factory Method
Defines an interface for creating an object, but lets subclasses alter the type of objects that will be created. -
Abstract Factory
Provides an interface for creating families of related or dependent objects without specifying their concrete classes. -
Prototype
Creates new objects by copying an existing object, known as the prototype. -
Builder
Separates the construction of a complex object from its representation, allowing the same construction process to create different representations.
These patterns are concerned with algorithms and the assignment of responsibilities between objects.
-
Strategy
Enables selecting an algorithm's behavior at runtime by encapsulating each one as a separate class. -
Observer
Defines a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically.
Each pattern has its own folder with:
- ✅ Code examples
- 📄 Explanation of the pattern
/DesignPatterns
/OOP-Concepts
/Creational
/Singleton-pattern
/Factory-pattern
/Abstract-Factory-pattern
/Prototype-pattern
/Builder-pattern
/Behavioral
/Strategy-pattern
/Observer-pattern
-
Clone the repository:
git clone git clone https://github.com/luanAfons0/DesignPatterns.git
-
Navigate into the pattern you're interested in:
cd DesignPatterns/Creational/Factory-pattern -
Run or read the examples.
Feel free to contribute by:
- Adding new design patterns
- Improving current examples
- Translating documentation
Please open an issue or submit a pull request!
Made with 💡 by [Luan Henrique Afonso]
📧 [luan.henrique.afonso04@gmail.com]
🔗 LinkedIn Profile