Shared Mutable Design
Our first approach to total work years is a familiar approach: write 0 on the board and ask everyone to walk up to add their work years to that total.
Fred, who’s closest to the board, jumps up to add his years to the total, and before we know it, a number of people have lined up, creating contention around the board. As soon as Fred is done, Jane gets her turn. We’ll have to keep an eye to ensure pranksters don’t change the entry to something impossible like infinity.
Shared mutability is at work here, along with the challenges it brings. We have to police more than one person trying to change the number at a given time. Furthermore, people have to patiently wait for their turn to write on the board as each person takes ...
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