Skip to content

Latest commit

 

History

History
108 lines (83 loc) · 3.03 KB

File metadata and controls

108 lines (83 loc) · 3.03 KB

Design Patterns Samples

This repository contains sample source code implementations of various design patterns.
The purpose is to provide a clean and practical reference for developers who want to understand how design patterns can be applied in real projects.

All examples are organized by categoriesdesign patternsprogramming languages.


📂 Repository Structure

.
├── Creational/              # Khởi tạo (Creational Patterns)
│   ├── Singleton/
│   ├── FactoryMethod/
│   └── AbstractFactory/
│
├── Structural/              # Cấu trúc (Structural Patterns)
│   ├── Adapter/
│   ├── Decorator/
│   └── Proxy/
│
└── Behavioral/              # Hành vi (Behavioral Patterns)
    ├── Observer/
    ├── Strategy/
    └── Command/

📖 Patterns Included

Creational

Pattern Link
Singleton View Code
Factory Method View Code
Abstract Factory View Code
Builder View Code
Prototype View Code

Structural

Pattern Link
Adapter View Code
Bridge View Code
Composite View Code
Decorator View Code
Facade View Code
Flyweight View Code
Proxy View Code

Behavioral

Pattern Link
Chain of Responsibility View Code
Command View Code
Iterator View Code
Mediator View Code
Memento View Code
Observer View Code
State View Code
Strategy View Code
Template Method View Code
Visitor View Code

Each folder contains subfolders for supported programming languages (e.g., Java, Php, ...).


🚀 Usage

  1. Navigate to the pattern folder you want to study.
  2. Choose the programming language (e.g., Java, Php).
  3. Open the source code files.
  4. Compile and run them locally.

Example:

cd Creational/Singleton/Java
javac *.java
java Main

📚 Reference

Concepts are based on Refactoring.Guru – Design Patterns. This repository only provides source code samples, not detailed explanations.


🤝 Contribution

You are welcome to contribute by:

  • Adding new design pattern implementations
  • Supporting more programming languages
  • Improving code quality

📜 License

Released under the MIT License. You can freely use, modify, and share the code with attribution.