BBC Sep 11, 2017

Kotlin: An Exploration of Sealed Classes

Article Summary

James Shephard from BBC explores how Kotlin's sealed classes can fundamentally reshape your Android architecture. What if callbacks aren't the answer to async operations?

A BBC engineer dives deep into Kotlin sealed classes, comparing them to Java's traditional approaches for handling different data types and async operations. The article challenges common patterns like receiver callbacks and explores how a simple language feature can trigger architectural rethinking.

Key Takeaways

Critical Insight

Sealed classes combined with when() syntax offer a cleaner, safer alternative to callbacks by decoupling thread marshalling from result handling at compile time.

The article reveals why making assumptions about callback contexts in your APIs might be limiting your architecture more than you realize.

Recent from BBC

Related Articles