The Mutable State Monster and How to Defeat it.
Shared mutable state is a curse on all programmers. It makes our code hard to read, hard to debug and hard to paralellize. But without it, our programs can’t do anything useful. Let’s see what we can learn from functional programming to tame this beast.
First order of business is to describe the monster. We must know the enemy to defeat it. What is mutable state? Why is it useful? Is it a necessary evil or something we can dispense with altogether?
Next, we study it’s modus operandi. What does it do exactly that makes gentlefolk go insane? What effects does it produce in concurrency? Why does it make debugging and reasoning about our code harder?
After that, we will look at various tools that functional programming offers us that can aid our quest. Referential transaprency and Immutable data structures are our allies.
Finally, we look at performance impact and how we can use these techniques in Android.
Anup Cowkur is an Android Engineer at GO-JEK. He’s been a professional Android developer for more than 5 years now. He’s a Google Developer Expert for Android. He also fiddles with Ruby, Elixir, Haskell and other weird stuff. He’s worked on several popular apps such as DeviantArt and Todoist. He likes open source and has created many libraries related to Android development. He’s also an organizer at Blrdroid, one of the biggest Android developer groups in the world.
When he’s not programming, he’s making terrible music with his band, “Kutte Ki Maut”.