The Big Difference Between Flows and Channels in Kotlin

<p>Maybe you&rsquo;ve heard Kotlin programmers say that &ldquo;<a href="https://elizarov.medium.com/cold-flows-hot-channels-d74769805f9" rel="noopener">channels are hot, flows are cold</a>.&rdquo;</p> <p>It&rsquo;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&rsquo;s not the whole story, because flows themselves come in at least two very different forms. That&rsquo;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 &ldquo;hot&rdquo; because they&rsquo;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&rsquo;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>