An open API service indexing awesome lists of open source software.

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

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
```