Posts

Showing posts from September, 2025

Why does TDD work? (Or why test driving your code is not a matter of "opinion")

Image
Test Driven Development. "TDD". Some love it, some hate it. But many studies now suggest that it is highly effective in reducing bugs (some studies suggest up to 90% of bugs can be eliminated) and improving code structure. But how does it work? Why is there such an effect from such a simple approach?  But before I start I must point out that a lot of what follows is summarising a great talk by Keith Braithwaite called " Measure for Measure: quantifying the effect of TDD " from 2008.  This is just a distillation of his somewhat mathematical analysis and conclusions, simplified, and in my own words aimed at a new audience who may have missed this particular gem. So our story starts with complexity. Cyclometric complexity to be precise. Cyclometric complexity simply explained is a measure of the number of paths through a piece of code. So it depends on the number of decision points - if, while, and switch statements etc. The more paths, the more complex the code is, an...

Conflating Answers with Learning: Using AI to Learn

Image
"A little learning is a dang'rous thing; Drink deep or taste not the Pierian spring: There shallow drafts intoxicate the brain, And drinking largely sobers us again" - from " An Essay on Criticism, Part II ", Alexander Pope Those who know me, or have read my profile online, know that I teach teams how to develop software using iterative tools and techniques. These require rewiring some of the traditional, waterfall-style thinking and approaches, and yes, they can be a culture shock. In order to warn my trainees I always go through a specific explanation with them. It kind of goes like this: Many folks expect learning to be straight line. You do a training course, or read a book for something, then you use it.  Unfortunately this is the South Park Underpants Gnomes model of learning. It leaves out the important part. Learning does not work in a straight line. It's messy. It's unpredictable. You will make mistakes. Go down blind intellectual alleys. Get co...