Isolated Mutable Design
I can walk up to the board, but instead of putting down the initial total of 0, I can put my phone number so everyone in the room can text their work years to me.
Each person now sends me the information from the comfort of their seats. They don’t have to wait in line, and they’re done as fast as they can punch those smartphone keys.
I’d receive the years in sequence as they arrive, but the senders are concurrent and nonblocking.
Isolated mutability is at work here. The total is isolated: only I hold this value, and others can’t access it. By isolating the mutable state, we’ve eliminated the problems of the previous approach. There are no worries of two or more people changing the stuff at the same time.
I’d continue ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access