A few weeks back I was working with a client on TDD. We were working on the first part of a new application, to figure out the design.

We wrote a test first, of course, for an end-to-end, happy-path scenario. But here’s a surprise.

Instead of building the main modules with TDD, we just filled in the blanks. We didn’t even try to pass the test, but get a feeling of how the code may look – which modules may be there, and how they interact. And when they needed to interact with an existing service, we abstracted it with a facade.

Then we moved the code around. We created a couple of empty classes, created a few interfaces, tucked the code into them and, presto, we had an over-arching design.  One we liked . We also had an end-to-end test, that with a few tweaks and hard-wiring passed.

In less than an hour, we had a clear view of the overall system design, implemented a skeleton, and a test that proves that skeleton works.

What’s your secret?

Don’t tell anyone: Creating those bits of code was cheap. It wasn’t risky. We could do whatever we want, without breaking anything. Without being afraid of breaking anything.

There was no commitment. No attachment to existing code. We didn’t come in with a plan, we just tried different options. We played with the design, until we got to a point where we felt that we had a good starting point.

And proof: Our tests gave us a glimpse of how the system would work.

Writing tests with minimal code, helped us explore options. Without commitment, and  with few small changes, we did something we rarely do.

We usually rush in to implement a fully “thought-out” plan, that we’d need to change later. This time we just played with code until it fit. And it can still move, we accepted it was just a first run.

Next time you’re building something new, don’t just build it. Don’t just draw it on the whiteboard, and implement the whole thing. Play with the code, using tests, to make sure the design works in code form. You’ll be surprised from what you’ll learn from the experience.


Here’s a note: The site is going through changes. It way look wonky, but the material is still awesome. If you found something that requires attention, let me know.

Categories: Uncategorized


Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *