Archive for the 'testing' Category

BTUF

No, you don’t need to read the title again, you are not mistaken. It really is a T instead of a D (or R, depending on where you come from). BTUF is the acronym for Big Testing Up Front. BTUF is basically what happens when people try to write all conceivable tests before starting to code. With the rise of Test-Driven Development this is an obviously ascending waterfall practice.

Testing is also designing. When you write the tests before the production code in good TDD style, what you essentially do is to design how the code will look from the outside. Sometimes it may be hard to resist the temptation to design everything before writing a single line of code, specially for those used to waterfall thinking. For those who can’t help doing it, here is some news from yesterday’s paper: it doesn’t work. Even though everybody minimally informed has already heard it, this message never gets said enough.

It doesn’t work because designing is infinitely better and easier when we can have fast feedback. Software development can easily be a high feedback activity. Architects need to wait for the construction team to finish the piece and film writers sometimes need to wait years for the shooting to finish, but programmers can just compile their programs. Giving up this feedback on purpose is not the smartest thing to do. Writing all tests for a piece of code before starting the code itself is no different than drawing rectangles and arrows describing it in full detail before trying to make the whole think work. The risk of over-engineering is the same because the code isn’t there to scream in agony.

The key to avoid BTUF is writing the tests that you can come up with before writing the code to make them green, but making sure not to think too much. You can wait to start writing the code after all tests are in place, but you don’t need and neither want to.

TDD has shown us that design isn’t made only of diagrams. In fact, we are designing all the time we are developing software. TDD is only one of many design techniques: one that uses tests. It may be a better tool than arrows and rectangles in some situations, but is still just an approach for design. BTUF is, therefore, just an special case of BDUF where tests are used to determine the design completely before writing a single line of code.