Limited side effects

Pure mathematical functions produce no side effects. In the programming world, this means that calling a given function will produce a single output and do nothing else. A pure function will return its output without manipulating global state, making network requests, updating databases, and more.

By writing functions that produce no side effects, we are again making it easier to reason about our data flows and how the state of our applications are expressed and manipulated. When functions are hyper-focused on a single, explicit task, it becomes much easier to understand how a state is modified.

Get Mastering Kotlin now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.