Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lmller/gof-in-kotlin
Gang of Four patterns in Kotlin.
https://github.com/lmller/gof-in-kotlin
kotlin patterns
Last synced: about 2 months ago
JSON representation
Gang of Four patterns in Kotlin.
- Host: GitHub
- URL: https://github.com/lmller/gof-in-kotlin
- Owner: lmller
- Created: 2017-05-24T14:10:53.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-11-15T19:39:29.000Z (about 6 years ago)
- Last Synced: 2024-08-01T02:26:09.795Z (4 months ago)
- Topics: kotlin, patterns
- Language: Java
- Homepage:
- Size: 145 KB
- Stars: 258
- Watchers: 14
- Forks: 21
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-design-patterns - gof-in-kotlin
README
![pull requests welcome](https://img.shields.io/badge/pull_requests-welcome-green.svg)
#### Gang of Four patterns in Kotlin.
Inspired by https://github.com/mariofusco/from-gof-to-lambda
Blog posts:
- Part 1: https://dev.to/lovis/gang-of-four-patterns-in-kotlin
- Part 2: https://dev.to/lovis/gang-of-four-patterns-in-kotlin---slight-returnWatch me talk about it: https://youtu.be/xxGCVVtMVn4 (2018 @code.talks hamburg)
| Pattern | Kotlin |
| --- | --- |
| Builder | `apply` function / named constructor parameters |
| Decorator | Extension Functions / function composition |
| Interpreter | `sealed` classes |
| Iterator | operator functions |
| Observer | observable delegate |
| Prototype | Data class |
| Singleton | `object` declaration |
| Strategy | functions |
| Template Method | (top-level) functions |
| Visitor | Pattern Matching / `when` |ℹ️ If you import the project into intelliJ, make sure to **un**check "Create separate module per source set"!