How Kotlin Lets Us Remove Exceptions from Our Code
summary
Kotlin features and techniques for eliminating exceptions from application code by using language constructs like sealed classes, Result, and nullable types to represent errors as values; demonstrates how to replace thrown exceptions with explicit error-handling types and functional-style composition to make error flows safer and more testable.
AI-written summary · about
chapters (17)
- 0:00Introduction
- 1:13Problem with exceptions
- 3:20Exceptions in Java and Kotlin
- 6:07When to use exceptions
- 8:55Bad exception habits
- 10:19Sealed classes and pattern matching
- 12:24Rewriting service with Outcome
- 15:57Performance benchmark
- 17:59Functional programming and Option
- 20:10Try and Either classes
- 22:58Monads and Aider class
- 27:33Arrow library benefits
- 30:42Validations and error zipping
- 32:06Error mapping and accumulation
- 33:10Testing with Aider
- 34:43Example with suspend functions
- 35:47Summary and conclusions
related talks
41mLeveraging Sealed Classes in Kotlin
17mDesigning for Errors in a Kotlin-first SDK:When to throw, nullify, or return a Result.
01h 03mHow Kotlin makes your Java code better
43mError Handling Strategies for Kotlin Programs
39mA Result for Our Issues
35mSealed Classes, Unsealed Complexity
30mWhat can Kotlin do for me?
49mAn Introduction to Kotlin
