Wednesday, December 30, 2015

Test Driven Design

My last post was critical of the new control language created to implement a concept called Behaviour Driven Design (BDD).

The process of creating a control language seems liberating at first because the creation process helps improve communications among the creators, but it soon becomes oppressive to those on the outside.

That criticism aside, I actually agree with many of the ideas discussed in Test Driven Design and Behaviour Driven Design.

A quality software shop tests it products thoroughly. Tests are difficult because one needs to test for both expected and unexpected conditions.

Programmers have a tendency to write programs for the way that they imagine people will use their program and fail to realize the creative things people actually do with code. The testers have to test the software for all the different permutations that might happen with the software. This means throwing invalid data at the software and even throwing malicious code at the software to see how it fares against hackers.


Imagine a simple procedure with 5 variables. The testing department has to test all the permutations of those variables.

Object Oriented Programs are even harder to test. Imagine a class with a dozen methods. The testing department needs to test all the paths through that object. 

I find that my testing scripts are generally magnitudes longer than the software itself.

New programs generally need to be tested against existing data. Which is itself a chore.

The idea behind Test Driven Design is that companies should design their tests before writing the software. This seems odd at first. But on considering the vast about of existing data laying around most companies have a good idea about the software will need to handle before coding begins.

Of course, building software around tests is an imbalanced approach. One needs to step back and ask fundamental questions about what the code should be doing ... the case for BDD.

But these questions are already part of the iterative design process.

Anyway, the process of getting my new web site up and running is taking an extremely long time because I am testing every single little piece of code and cranking through some really fundamental questions about the way I want the programs to behave.

No comments: