Sealed Classes Opened My Mind: How We Use Kotlin to Tame State at Etsy
summary
Describes using sealed classes plus Kotlin’s when and IDE exhaustiveness checks to model social sign‑in state at Etsy, splitting the flow into three sealed data classes that represent the three API responses (social, sign‑in, 2FA) rather than one huge tree. Shows using filterIsInstance (and RxJava mapping) to get filtered views so when only handles wool‑level cases, compares this to visitor/instanceof patterns, and explains why this reduces bugs and boilerplate.
AI-written summary · about
chapters (13)
- 0:00Intro
- 0:47Managing State
- 2:01What are Sealed Classes
- 3:29Example
- 8:45New Example
- 14:31Social Signin
- 16:21Model
- 18:25Duplication
- 23:59Why Kotlin
- 25:57Kotlin Visitor Pattern
- 27:46Kotlin Delegate Adapter Pattern
- 29:57Kotlin Switch Statement
- 31:38What are we trying to solve
related talks
35mSealed Classes, Unsealed Complexity
41mLeveraging Sealed Classes in Kotlin
42mDissecting Kotlin: Unsealing the Sealed, the SAM, and Other Syntax
43mFrom Effective Java to Effective Kotlin
39mHow to Kotlin - from the lead Kotlin language designer
32mWhen Clean Architecture met Kotlin, A love story
31mDesign Patterns with Kotlin
46mFireside chat
