Saturday, May 19, 2007

Keep Your Tail Short

Bookmark and Share

Doing some research this evening, I came across a post related to Test Driven Development (TDD) by Jeremy Miller. This was a nice way to describe the importance of keeping the responsibilities of a component very specific and its coupling precisely controlled.


Keep Your Tail Short. The best description for this general concept I've ever heard comes from Stuart Holloway - "When you pull a class off the shelf, what else is coming with it?." Think of it this way, if I want to test my business rules, or my display logic for that matter, what other areas of the code do I have to pull as well? By and large you want to answer that question with "not much." Writing test code just to placate my database or web server when I'm testing business logic is purely overhead -- both in terms of the mechanics of creating the test and the intellectual overhead of understanding the test.
While this refers to an Object-Oriented context, the principle applies perfectly well in just about any development environment, and we see evidence in this scenario of the fact that good design is essential to good testing.

Let's make sure we're able to take just what we need off the shelf... no strings attached.


No comments: