Tag Archives: code

what’s the london school of tdd?

I’ve been hearing about the London school of TDD, and I’m puzzled. This post by Jason Gorman was helpful, but his examples confused me.

In describing classic TDD (as in TDD by Example), he uses as his example a program to express integers as Roman numerals. Then he gives an example for London school (as in Growing Object Oriented Software Guided By Tests) that is bigger, more complex. I’m not sure how to compare them.

I’m wondering whether London-style TDD provides the same advantages as classic TDD. From Wikipedia:

TDD can lead to more modularized, flexible, and extensible code. This effect often comes about because the methodology requires that the developers think of the software in terms of small units that can be written and tested independently and integrated together later. This leads to smaller, more focused classes, looser coupling, and cleaner interfaces.

I’m just starting to read the second book; I’ll know more as I get into it. But I’m really curious: does London school take the same sort of tiny steps that classic TDD advocates? Does it retain the benefits of TDD? I figure you get test coverage, but do you also get emergent design? Simple* design?

* See the four rules of simple design, as explained by Ron Jeffries.

Do loops add cyclomatic complexity?

I have been asking folks if loops add to cc. I think they’ve been telling me no pretty consistently, and I’m confused about that. I can see a Ruby  3.times do  wouldn’t add complexity. But doesn’t a java for loop contintually check whether the iterator is or isn’t bigger than some value? Why wouldn’t that count as a conditional?

Maybe none of this matters. Maybe if I take care of duplication, expressivness, responsibility, nobody cares. But dang it, I care. ^__^

GeePawHill sez…

Good lord, how am *I* supposed to know?

Actually, as far as I can tell, the loop itself inherently only creates one forking path extra. The path is identified by the condition while the loop is run vs. the condition when it is stops running.