The Big Difference Between Flows and Channels in Kotlin
<p>Maybe you’ve heard Kotlin programmers say that “<a href="https://elizarov.medium.com/cold-flows-hot-channels-d74769805f9" rel="noopener">channels are hot, flows are cold</a>.”</p>
<p>It’s a useful distinction between two ways of working with an asynchronous data stream. Flows and channels are as different as functions and objects. But that’s not the whole story, because flows themselves come in at least two very different forms. That’s where the limited hot and cold analogy starts to break down.</p>
<p>How can we improve the vague metaphor into something more concrete and actionable?</p>
<p>We call channels “hot” because they’re stateful objects. A channel is a communication mechanism that lets you receive values from other computations. As the consumer, your interaction with the channel doesn’t necessarily control when that computation starts and stops.</p>
<p><a href="https://betterprogramming.pub/stop-calling-kotlin-flows-hot-and-cold-48e87708d863">Website</a></p>