Aim Small, Miss Small

There was something about movie epics from the 90s. They had action packed sequences, everything turned out OK in the end, and they didn’t try to stretch their source material into three movies (Luckily the Matrix was only one movie; I hope they do make sequels).

In The Patriot, there’s a scene where Mel Gibson and his sons ambush a British Squad, and he reminds them aim small, miss small. Having never really grown up around marksmanship or hunting, I didn’t understand the phrase at the time. Now though, I get it.

If you aim at a large target, you may miss that large target and hit nothing. If you aim for a small part of that target, and you miss, you’ll still likely hit the larger target.

It’s the same way with TDD. If you try to TDD something large, you’ll end up (likely) with a jumble of code that tries to do too much. If you instead stop and take very small steps and aim for very small results, you’ll get those results, and even if you were to miss, you’ll still have hit your target area.

As a practical example; if your application exposes a custom search feature; you may be tempted to try to TDD that whole feature at once, from the user’s perspective. This is commonly referred to as “Outside-in” TDD, or the London School of TDD. Instead, break the problem down and only try to use TDD for a small part of it. For instance, TDDing the syntax of a search query. In doing that, in fleshing out the syntax (a very small part of overall search), you’ll find answers and questions and flesh out requirements you might never have seen if you focused on search as a whole.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.