Comparison Jeopardy

A game to train your naming skills

Comparison Jeopardy

A game to train your naming skills

Naming is hard. That’s why Linus and myself have “developed” a game called Comparison Jeopardy that helps you train your naming skills so you provide better advice in code reviews. And have some fun, too!

There are only two hard things in Computer Science: cache invalidation and naming things. — Phil Karlton

Idea

Let me first start how we came up with the idea of Comparison Jeopardy, because I think it’s an interesting story to tell. In April 2018, our book “Java by Comparison” got published. In the book, there are 70 comparisons, each contrasting bad code with better code along with an explanation and an actionable name. One of the hardest parts in writing the book has been to give each of our 70 comparisons a name. Most names were the result of long discussions and many renamings. But those discussions were great, I still have them in fond memory today. Back then, we wanted to spread the word about our book and we found a nice meetup in Nuremberg, Germany where we could give a talk about it. The first part of the talk was about the history of the book and how it came into being. For the second part, we wanted to do something fun and interactive with the contents of the book. We thought long and hard and ended up playing the Comparison Jeopardy for the very first time.

Let’s Play

Let me show you how the game works.

Comparison with bad code on the left and better code on the right.

At first, you show a comparison. Here’s an example of a comparison with bad code on the left and better code on the right, taken from our book Java by Comparison. Be sure to align the code listings so that any participant can compare it easily. Also, check that you use code snippets that aren’t too large and still readable when projected on the wall. We put a lot of effort into making the code snippets in our book concise, leaving out things like visibility modifiers like “public” if they didn’t add value. We advise you to do that, too.

We gave the audience some time to read the code, typically a minute or two, so they could ponder on the comparison. During that time, you shouldn’t say anything and really let the audience read and think. We recommend setting a timer to make sure you give the audience enough time. You may take your time now reading the code above, so you can experience the game as well!

Tell the audience to find an actionable name for that comparison that starts with a strong verb.

After a few minutes of silence, we asked them how they would name that comparison. The only restriction we put out is that the name must start with a verb, preferably strong verbs. Tell them to try to stay away from weak verbs like “avoid”, “use” or “do”. We discussed each name whether it would really convey the meaning of this comparison with the audience. Make sure to take your time here, because this is the most interesting part. And be prepared that they come up with way better names than you had in mind for the comparison, which is a good thing!

Comparison including the suggested name

Last, show them the name you’ve chosen as shown in the example below. From our experience, normally, our name was simply acknowledged as very good. Sometimes, however, it fuelled yet another short but interesting discussion.

Don’t forget to write down the suggestions of the audience, especially the ones that were better than your own name. For that, it’s best to moderate the game with two “game show hosts”, so that one can participate in the discussion and the other can just follow the discussion, taking notes when necessary. We typically take turns, so that it’s fun for both hosts.

Tried and Tested

Linus and I have tried out the game three times already, each time in a different setting using up to ten comparisons from our book:

  • At university with students
  • At a meetup with students and professionals
  • At an internal company meeting with professionals

And each time, we got very positive feedback. We hope to play that game at some other meetups and companies in the future as well. We’ll update that site here if we learn more about how to play “Comparison Jeopardy” even better. Stay tuned!