https://github.com/matusstafura/design-patterns-study
Design Patterns in various languages
https://github.com/matusstafura/design-patterns-study
cpp design-patterns gang-of-four go golang java javascript php python
Last synced: 3 months ago
JSON representation
Design Patterns in various languages
- Host: GitHub
- URL: https://github.com/matusstafura/design-patterns-study
- Owner: matusstafura
- Created: 2025-01-27T18:20:14.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-04-03T06:51:33.000Z (over 1 year ago)
- Last Synced: 2025-08-05T00:14:29.024Z (12 months ago)
- Topics: cpp, design-patterns, gang-of-four, go, golang, java, javascript, php, python
- Language: PHP
- Homepage:
- Size: 55.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Design Patterns
## List of Design Patterns
| # | Type | Name | C++ | Java | GO | JS | PHP | Python |
|----|-------------|-------------------------------------------|-----|------|----|----|-----|--------|
| | Creational | Factory Method | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| | Creational | Abstract Factory | ❌ | ✅ | ✅ | ✅ | ✅ | ✅ |
| | Creational | Builder | ❌ | ✅ | ✅ | ✅ | ✅ | ✅ |
| | Creational | Prototype | ❌ | ✅ | ✅ | ✅ | ✅ | ✅ |
| | Creational | Singleton | ❌ | ❌ | ❌ | ❌ | ✅ | ❌ |
| | Structural | Adapter | ❌ | ✅ | ✅ | ✅ | ✅ | ✅ |
| | Structural | Bridge | ❌ | ✅ | ✅ | ✅ | ✅ | ✅ |
| | Structural | Composite | ❌ | ✅ | ✅ | ✅ | ✅ | ✅ |
| | Structural | Data Mapper | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
| | Structural | Decorator | ❌ | ✅ | ✅ | ✅ | ✅ | ✅ |
| 10 | Structural | Facade | ❌ | ✅ | ✅ | ✅ | ✅ | ✅ |
| 11 | Structural | Flyweight | ❌ | ✅ | ✅ | ✅ | ✅ | ✅ |
| 12 | Structural | Proxy | ❌ | ❌ | ❌ | ❌ | ✅ | ✅ |
| | Structural | Registry | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
| | Structural | Twin | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
| | Behavioral | Blackboard | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
| | Behavioral | Chain of Responsibility | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
| | Behavioral | Command | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
| | Behavioral | Fluent interface | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
| | Behavioral | Interpreter | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
| | Behavioral | Iterator | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
| | Behavioral | Mediator | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
| | Behavioral | Memento | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
| | Behavioral | Null Object | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
| | Behavioral | Observer | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
| | Behavioral | Servant | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
| | Behavioral | Specification | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
| | Behavioral | State | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
| | Behavioral | Strategy | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
| | Behavioral | Template Method | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
| | Behavioral | Visitor | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
## Extra
| Creational | Static Factory Method | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
| Creational | Pool | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
| Creational | Simple Factory | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
| Creational | Dependency Injection | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
| Creational | Lazy initialization | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
| Creational | Multiton | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
| Creational | Object pool | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
| Creational | RAII | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
| Structural | Delegation | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
| Structural | Dependency Injection | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
| Structural | Extension object | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
| Structural | Fluent Interface | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
| Structural | Front controller | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
| Structural | Marker | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
| Structural | Module | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
| Extra | Service Locator | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
| Extra | Repository | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
| Extra | Entity-Attribute-Value (EAV) | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
| Concurrency | Active Object | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
| Concurrency | Balking | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
| Concurrency | Binding properties | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
| Concurrency | Compute kernel | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
| Concurrency | Double-checked locking | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
| Concurrency | Event-based asynchronous | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
| Concurrency | Guarded suspension | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
| Concurrency | Join | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
| Concurrency | Lock | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
| Concurrency | Messaging design pattern (MDP) | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
| Concurrency | Monitor object | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
| Concurrency | Reactor | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
| Concurrency | Read-write lock | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
| Concurrency | Scheduler | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
| Concurrency | Service handler pattern | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
| Concurrency | Thread pool | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
| Concurrency | Thread-specific storage | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
| Concurrency | Safe Concurrency with Exclusive Ownership | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
| Concurrency | CPU atomic operation | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
### Study Materials
#### python
- [https://python-patterns.guide/](https://python-patterns.guide/)
### Compile/Run
```bash
# C++
g++ cpp.c -o cpp && ./cpp
# python
python3 python.py
# go
go run go.go
# java
javac Main.java && java Main
# javascript
node javascript.js
# php
php -f php.php
```