Patterns Poker is a game you can play to learn the subtle art of how to combine Patterns. We currently play this game with a deck of Design Patterns Playing Cards, but it may be played with other catalogs of Patterns or Pattern Languages.Patterns Poker was invented by Joshua Kerievsky, who has written up a brief history of the game.

### Rules

If you’ve never played the traditional card game, Poker, don’t worry - you can learn to play Patterns Poker in a few minutes. The basic idea of Patterns Poker is to come up with great pattern combinations in order to tell a great story about them.

We’ll start by telling you how to play the game, and then explain how you can have even more fun by betting as you play.

There can be 2 to 14 players. If you are new to patterns or Patterns Poker you may enjoy teaming up with someone while you play. A hand consists of 5 cards. Jokers are wild (the holder of a joker can designate it as any card, except as a card already in his hand).

### Procedure

1. Cards are dealt. The dealer shuffles the deck 3 times. He then deals out the cards one at a time, face down, beginning with the player at his left. Each player is dealt 5 cards.
2. Players study their cards. The goal is to look for great pattern combinations and stories you can tell about your cards. Perhaps all 5 cards you were dealt form an excellent story, complete with classic combinations of patterns. Or maybe you need to exchange a few cards (see below) to get the perfect hand. Players often find it helpful to consult the patterns literature while they study their cards.
3. Players exchange cards. Each player has one chance to discard up to 3 cards in exchange for new cards. This is normally done in the same order in which the cards were dealt (though you don’t have to be strict about this if you want to save time). Place discarded cards in a separate pile and shuffle them back into the deck after a few hands.
4. Players invent stories about their cards. Each player must invent a short story about his cards. The story could be about how a system, or part of a system, is implemented using the patterns. The story need not be about all 5 patterns, if 1 or 2 of the cards simply doesn’t fit in with the story. In some cases, a player may wish to tell a story about 3 cards, and tell another related story about the other 2 cards. Typically, the best stories show how all 5 cards work together in a system.
5. Players tell their stories. Storytelling is the most important part of Patterns Poker. If you can tell your story well, you may win that deal. If your story is far-fetched, you probably won’t win. When everyone is ready, each player takes a turn to show his cards and tell his story. Storytelling usually takes about 1-4 minutes for each player. If someone doesn’t understand part of a story, he may ask for clarification. A player may also fold, meaning he drops out of the round because he doesn’t think he has a chance of winning. If he folds, he must use his turn to explain why his patterns wouldn’t work well together.
6. The group decides on the best story. Once all players have told their stories, it’s time to decide who wins that deal. This is a judgement call for the group. If you have a designated dealer (who is not playing the game but just dealing cards), he can help make the final decision about the best story. The best stories typically involve a classic combination of patterns implemented in a plausible software system. Plausible stories about dense combinations of patterns usually have more value than stories about systems that implement patterns in diverse places (e.g. the database layer uses this pattern, the GUI uses that pattern).

The same sequence is repeated for the next deal.

### Betting

It’s a lot of fun to bet while you play Patterns Poker, and you don’t need real money. In our Design Patterns Workshop, we often use candy for chips, though you have to be careful that players don’t eat their winnings during play! Hershey’s miniature assortment works well, and we typically use milk chocolate for the ante.

Before play, one player is selected as the banker. All chips are given to him to issue to players. Everyone gets the same amount of chips. Chip values are as follows:

• White chips have the lowest value.
• Red chips represent 2 white chips.
• Blue chips represent 4 white chips.
• Black chips represent 8 white chips.

Each deal is a separate game. Before each deal, every player contributes a minimum bet, called an ante, to form a pot. We typically use 1 white chip for the ante.

After players receive and look over their cards, they may increase their bets. When the first player increases his bet, each player after him may:

• drop by discarding his hand, thus giving up any chance to win the pot.
• call by matching the number of chips placed in the pot by the first player, or
• raise by placing enough chips in the pot to call plus one or more additional chips.

When it is his turn, a player should announce whether he is dropping, betting, calling or raising; if he is betting or raising, he should announce the amount.

A betting interval ends when every active player has had at least one turn to bet and when those bets have been equalized (i.e., when other players have matched or dropped). After the betting interval, players tell their stories, beginning with the player to the dealer’s left. All players tell a story, regardless of whether they have dropped or not. The player with the best story wins the pot.

Check out our photo gallery of Patterns Poker being played at OOPSLA, SD East, and other places.

### History of the Game

Author: Joshua Kerievsky
Created: October 11, 2000

One day, in the Spring of 2000, I was leading a small group of folks through our popular and intensive Design Patterns Workshop. By this point in the workshop, participants had studied 18 of the 23 Patterns covered in our class. This meant that we were close to realizing one of the workshop’s main objectives: to give participants a thorough education in all 23 Design Patterns from the classic book, Design Patterns: Elements of Reusable Object-Oriented Software.

That afternoon, while participants studied passages from the next Pattern in the series, I reflected on how each one of them was doing in the workshop. Just then I was greeted by a rather bothersome thought: while the participants and I had spent time during the workshop discussing the classic and not-so-classic combinations of Design Patterns, and how these combinations can help produce simple, flexible and extensible designs, I did not have confidence that each participant possessed a thorough understanding of this important subject.

And that lack of confidence bothered me.

The workshop clearly needed a way to measure what each participant understood or didn’t understand about combining Patterns. But how would I do that? After some reflection, I decided that a fun, non-threatening game would be just the right tool.

So I began brainstorming in class, searching for a game that would work. After tossing aside several ideas, I hit upon Poker, the popular U.S. card game. In traditional Poker, players win hands by combining cards in various ways. I simply needed participants to win hands by combining Patterns in various ways. Poker with Patterns?!?!

It was certainly worth a try!

Moments later, I assembled a set of playing cards, explained the new game to the participants and dealt the first hand of Patterns Poker. Twenty minutes later, I was delighted to discover that everyone loved the game! But even more important, the game helped participants review, clarify and retain their knowledge about Pattern combinations.

And that’s the story about how Patterns Poker came to be.

We are now happy to share this game with you. We hope you enjoy playing, and would love to hear about your experiences playing the game.