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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.