[en] All 23 Gang of Four design patterns implemented in 8 languages: Go · Python · TypeScript · Java · PHP · React.js · AngularJS · Angular 2+.
[pt-br] Todos os 23 padrões de projeto GoF implementados em 8 linguagens: Go · Python · TypeScript · Java · PHP · React.js · AngularJS · Angular 2+.
Inspired by / Inspirado por: Refactoring Guru
# Clone the repo
git clone https://github.com/luizwbr/awesome-design-patterns-examples.git
cd awesome-design-patterns-examples
# Pick a pattern and a language, then run it:
# Go
go run patterns/singleton/go/main.go
# Python
python patterns/singleton/python/Singleton.py
# TypeScript
tsx patterns/singleton/typescript/Singleton.ts
# Java
cd patterns/singleton/java && javac Singleton.java && java Singleton
# PHP
php patterns/singleton/php/Singleton.php| Pattern | Go | Python | TS | Java | PHP | React | AngularJS | Angular 2 |
|---|---|---|---|---|---|---|---|---|
| Factory Method | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| Abstract Factory | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| Builder | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| Prototype | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| Singleton | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| Pattern | Go | Python | TS | Java | PHP | React | AngularJS | Angular 2 |
|---|---|---|---|---|---|---|---|---|
| Adapter | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| Bridge | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| Composite | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| Decorator | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| Facade | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| Flyweight | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| Proxy | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| Pattern | Go | Python | TS | Java | PHP | React | AngularJS | Angular 2 |
|---|---|---|---|---|---|---|---|---|
| Chain of Responsibility | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| Command | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| Iterator | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| Mediator | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| Memento | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| Observer | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| State | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| Strategy | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| Template Method | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| Visitor | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
patterns/
└── pattern-name/
├── go/
├── python/
├── typescript/
├── java/
├── php/
├── reactjs/
├── angularjs/
└── angular2/
[en] Automated tests run on every push via GitHub Actions for Go, Python, TypeScript, Java, and PHP.
[pt-br] Testes automatizados rodam a cada push via GitHub Actions para Go, Python, TypeScript, Java e PHP.
[en] Read CONTRIBUTING.md to get started. All contributions require a DCO sign-off.
[pt-br] Leia CONTRIBUTING.md para começar. Todas as contribuições requerem DCO sign-off.
MIT — see LICENSE.