Gang of Four patterns in Kotlin.
Inspired by https://github.com/mariofusco/from-gof-to-lambda
Pattern | Kotlin |
---|---|
Builder | apply function |
Decorator | Extension Functions |
Interpreter | sealed classes |
Iterator | operator functions |
Observer | observable delegate |
Prototype | Data class |
Singleton | object declaration |
Strategy | functions |
Template Method | (top-level) functions |
Also read the blog post, maybe: https://dev.to/lovis/gang-of-four-patterns-in-kotlin