Design Patterns

Creational Patterns

builder pattern in Kotlin


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


Ensure a class only has one instance, and provide a global point of access to it.

Design Patterns, GoF


Postpone the creation of an object to a later point.

In Kotlin
abstract factory pattern in Kotlin

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

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

Delegation / Delegator

Composition instead of large Inheritance chains.

In Kotlin
Strategy pattern in Kotlin


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


Allow an object to alter its behavior when its internal state changes.The object will appear to change its class.

Design Patterns, GoF