This workshop was originally given at XP Utah, January 13, 2010.

The intent was to explore interaction-style TDD in C++. "Interaction-style" TDD is also called mockist-style, or London-style after London's Extreme Tuesday club where it became popular. It is usually contrasted with Detroit-style or "classic" TDD which is more state-based.

Interaction-style TDD is explained in depth in Steve Freeman's book Growing Object Oriented Software Guided By Tests

It can be challenging to get started unit testing in C++. We hoped this kata would lower the barrier to entry. We also wanted to explore the Google Mock framework, as none of us had used it before.

RichardThomson came up with the Bounded Queue idea for the kata. ZhonJohansen designed the initial kata steps. KayJohansen tested the steps, modified them somewhat, and wrote them up.

Description of Problem

We want to insert a queue between two objects in our system. One object puts items on the queue; let's call it a "Producer." The other object pulls items off the queue; let's call it a "Consumer."

Our queue needs to have a little bit of intelligence. We want it to notify the Producer when it can and can't accept items. For example, if the queue is full, it needs to tell the Producer to stop sending items. We also want the queue to notify the Consumer when it can and can't grab items; for example, when the queue is empty, the consumer should stop requesting items.

Interaction-style TDD allows us to flesh out an entire class without having to implement any part of other classes. This is easy to do using interfaces and mocks. In this kata, we will develop the Queue class, without having to implement the Producer or Consumer classes.

We will do this by creating an interface called QueueControl that our hypothetical Producer and Consumer would need to inherit and implement.

This Kata should take about 45 minutes after you have completed necessary setup (installing googlemocks, etc.) If you're ready to start, proceed to BoundedQueueKataStepZero.

BoundedQueueKata (last edited 2010-01-17 00:46:25 by KayJohansen)