Creational Patterns
![builder pattern in Kotlin](https://in-kotlin.com/wp-content/uploads/2022/01/builder_pattern_in_kotlin.png 685w, https://in-kotlin.com/wp-content/uploads/2022/01/builder_pattern_in_kotlin-300x243.png 300w)
![builder pattern in Kotlin](https://in-kotlin.com/wp-content/uploads/cwv-webp-images/2022/01/builder_pattern_in_kotlin.png.webp)
Builder
Separate the construction of a complex object from its representation so that the same construction process can create different representations.
Design Patters, GoF
![singleton pattern in Kotlin](https://in-kotlin.com/wp-content/uploads/2022/02/singleton_pattern_in_kotlin.png 422w, https://in-kotlin.com/wp-content/uploads/2022/02/singleton_pattern_in_kotlin-300x248.png 300w)
![singleton pattern in Kotlin](https://in-kotlin.com/wp-content/uploads/cwv-webp-images/2022/02/singleton_pattern_in_kotlin.png.webp)
Singleton
Ensure a class only has one instance, and provide a global point of access to it.
Design Patterns, GoF
Lazy
Postpone the creation of an object to a later point.
In Kotlin
![abstract factory pattern in Kotlin](https://in-kotlin.com/wp-content/uploads/2022/01/abstract_factory_in_kotlin.png 924w, https://in-kotlin.com/wp-content/uploads/2022/01/abstract_factory_in_kotlin-300x179.png 300w, https://in-kotlin.com/wp-content/uploads/2022/01/abstract_factory_in_kotlin-768x457.png 768w)
![abstract factory pattern in Kotlin](https://in-kotlin.com/wp-content/uploads/cwv-webp-images/2022/01/abstract_factory_in_kotlin.png.webp)
Abstract Factory
Provide an interface for creating families of related or dependent objects without specifying their concrete classes.
Design Patterns, GoF
Factory Method
Define an interface for creating an object, but let subclasses decide which class to instantiate. Factory Method lets a class defer instantiation to subclasses.
Design Patterns, GoF
Behavioral patterns
![observer pattern in Kotlin](https://in-kotlin.com/wp-content/uploads/2022/01/observer_pattern_in_kotlin.png 468w, https://in-kotlin.com/wp-content/uploads/2022/01/observer_pattern_in_kotlin-300x186.png 300w)
![observer pattern in Kotlin](https://in-kotlin.com/wp-content/uploads/cwv-webp-images/2022/01/observer_pattern_in_kotlin.png.webp)
Observer / Listener
Define a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically.
Design Patterns, GoF
![Delegation and Composition in Kotlin](https://in-kotlin.com/wp-content/uploads/2022/02/kotlin_interface_delegation.png 557w, https://in-kotlin.com/wp-content/uploads/2022/02/kotlin_interface_delegation-300x151.png 300w)
![Delegation and Composition in Kotlin](https://in-kotlin.com/wp-content/uploads/cwv-webp-images/2022/02/kotlin_interface_delegation.png.webp)
Delegation / Delegator
Composition instead of large Inheritance chains.
In Kotlin
![Strategy pattern in Kotlin](https://in-kotlin.com/wp-content/uploads/2022/02/strategy_pattern_in_kotlin.png 815w, https://in-kotlin.com/wp-content/uploads/2022/02/strategy_pattern_in_kotlin-300x117.png 300w, https://in-kotlin.com/wp-content/uploads/2022/02/strategy_pattern_in_kotlin-768x300.png 768w)
![Strategy pattern in Kotlin](https://in-kotlin.com/wp-content/uploads/cwv-webp-images/2022/02/strategy_pattern_in_kotlin.png.webp)
Strategy
Define a family of algorithms, encapsulate each one, and make them interchangeable. Strategy lets the algorithm vary independently from clients that use it.
Design Patterns, GoF
![state pattern in Kotlin](https://in-kotlin.com/wp-content/uploads/2022/02/state_pattern_in_kotlin.png 862w, https://in-kotlin.com/wp-content/uploads/2022/02/state_pattern_in_kotlin-300x172.png 300w, https://in-kotlin.com/wp-content/uploads/2022/02/state_pattern_in_kotlin-768x440.png 768w)
![state pattern in Kotlin](https://in-kotlin.com/wp-content/uploads/cwv-webp-images/2022/02/state_pattern_in_kotlin.png.webp)
State
Allow an object to alter its behavior when its internal state changes.The object will appear to change its class.
Design Patterns, GoF