Saturday, September 2, 2023

TDDbE: Mixed Currencies

We're finally ready to write the real test that motivates this entire problem... and so of course Beck wants to change up the API again.

This is what we'd like to write.

I'm not so sure.  What immediately stands out to me is that the proposed test is using mixed vocabulary.  We have Money, and Banks (a facade in front of an exchange rate), and Expressions.  One of these things is not like the others.

Anyway, the plan is to write the test using the language that will currently work.  That test fails, so the implementation gets updated to restore the green bar.

Then, under the protection of Green and the compiler, the interfaces are rewritten into the language of Expressions.

To avoid the ripple effect, we'll start at the edges and work our way back to the test case.

A good reminder that we have the tests so that we can take small steps with immediate feedback, rather than making all of the changes in one chunk.

No comments:

Post a Comment