BB5 - A Bank Transfer Example

James Coplien has implemented a DCI infrastructure in C++. He has also developed a simple program that illustrates the DCI essentials. The Squeak/DCI code for roughly the same problem is documented here.

The example story is that a human uses an Automatic Teller Machine (ATM) to transfer funds from her checking account to her savings account. She knows that her checking account is account number 1111 and that her savings account is account number 2222. The amount she wants to transfer on this occasion is $500.

The problem is to program the transfer. We follow the DCI paradigm and organize our code in the three essential perspectives; Data, Context, and Interaction. We can freely choose to begin with the static, Data perspective or the dynamic, Interaction perspective because the two are very loosely coupled through the Context. We here choose to start with specifying system behavior in the Interaction perspective. In addition, we have a Testing perspective where the BB5aTesting class drives the system.

The code can be studied in situ in Squeak/DCI (BabyIDE.ZIP) or in the HTML-file

BB5aBank listing.