From Messy to Tidy: A Practical Guide to Writing Clean Kotlin Code
summary
Demonstrates concrete Kotlin fixes: model units to avoid the 20 kg vs 45 lbs bug by using wrapper then value class/inline class so arithmetic compiles to primitives and prevents adding pounds to kilograms; add extension properties (e.g. 20.kg) and operator fun plus returning a new value; warns against overloading unused ops (kg kg → kg²). Recommends characterization tests*, small refactors, dependency inversion and single-function interfaces instead of heavy base interactors.
AI-written summary · about
chapters (9)
- 0:00Introduction to clean Kotlin
- 3:19Compiler and testing for reliability
- 7:18Value classes for type safety
- 12:19Wrapping strings like email
- 14:05Avoiding over-engineered base classes
- 17:59Refactoring for clean code
- 20:31Clean code as guidelines
- 23:40Tools for readability
- 24:47Summary and resources








