Exploring Design Options

Dealing with state is an activity that takes practice in the art of programming. What we do with the input we receive, the results of calculations, and the files we change all involve state. We can’t avoid state, but we have a choice of how to deal with it. Here we’ll first pick an example and in the next few sections explore different options to dealing with its state.

At a recent Java user group meeting, the conversation rolled over to the topic of collective experience among the members. I saw the young and the mature in the gathering and volunteered to total the number of years of experience. Let’s explore the options I had available to complete this task.

At first thought, the net years would change as I totaled ...

Get Programming Concurrency on the JVM 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.