Implementing the New Architecture

So that we can show you what it’s like to have a flickering scenario, we’ll start by changing the architecture underneath the same test code. We’ll demonstrate the flickering scenario and, in a final flourish, fix it by changing the tests to use sampling to synchronize with the system.

Driving Out the Interfaces

The Account class is where the ATM is going to interface with our new backend services. As shown in the figure ​here​, the two touch points are the TransactionQueue and the BalanceStore. Let’s design the interfaces to those objects by changing our Account class to use two imaginary objects that can talk to these services:

 require_relative ​'transaction_queue'

Get The Cucumber Book, 2nd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.