Great, I’ve got my incoming defect strategy nailed,
Now how do I prevent defects and debt in new code?
In 5 words…
Continuous attention to technical excellence.
Here’s my top 7 (there are plenty more)
Acceptance Criteria – Be really disciplined on your acceptance criteria & acceptance tests, team up with Analysts, Testers, Product Owners if you have them and attack your stories from every angle. A good approach to this is a “story kick-off” where the whole team dismantles a story before starting.
Thinking Time – don’t just start coding right away, task things out, try the 10 minute test plan, discuss your approach with your peers and for more complex or large items, try the “just enough design” approach.
TDD – It’s hard to start but has an immense impact. I’ve just seen a team complete their first project using TDD. 3 weeks into their final round of post feature-complete testing, their defect run-rate hasn’t had the testing spike seen on prior projects. In fact they’re keeping on top of all new incoming defects and have time to start paying down the historic backlog.
Pair Programming – Do it in half-day trial chunks if you don’t have the stomach for going full-tilt. I’ve performed remote pair-programming with colleagues across the Atlantic using decent phone headsets and online collaboration tools for hours at a time. The net result of 2 days of remote pairing was finding and fixing about 10 extra defects in a thousand lines of code that neither of us would have found coding alone.
Peer reviews – there is still a huge space for these in agile teams. But here’s the thing. Be really tough. A peer review is not a hurdle. It’s a shared learning exercise. Functional correctness is actually the smallest component of a peer review. You should trust your developers that far. But there’s a whole series of other aspects to review. See the joy of peer reviews.
Small tasks – I once worked with an outsourced team who when taking work would disappear into a hole for 2 weeks and return with a single task in our configuration management system containing edits to 200+ files and multiple condensed edits to the files. My rule of thumb is one reviewable task per activity. If you’re going to add new functionality and refactor, that’s 2 independent tasks that can be identified and reviewed separately. This means you should be able to easily deliver 2 reviewable, closable tasks per day.
Fast Builds – make it insanely simple for a developer to perform an incremental build that validates new code against the latest main code line. (small tasks are a big help here). This includes the right subset of unit and functional tests. Aim for a target of a 30 second response time or less between hitting the button and seeing the first results.
In the next article in this series I’ll focus on “Tailing” – How do you start reducing the old defects.
Analogy: (This one makes me think of the campfire scene in blazing saddles even though it’s only partially relevant)…
You only open the lid on a new can of beans when there isn’t enough in the current can to feed the family.
Underlying Concept: One of the key ways of delivering maximum throughput on teams is to limit WIP (work in progress/process). Teams inexperienced at this tend to start additional items or “break the seal” on new work when blocked or when a team member has completed their last personal task. We need the team to take a hard look at the work at hand, consider swarming around a given item or story and only open the lid on a new item if there really is no additional value to be gained from another member of the team helping out on the current top priority item.
This works on many levels – here’s a few…
Every time you open a new can you risk not finishing it all and having to throw the leftovers away.
Opening too many cans and forcing the family to eat them all causes bloating.
Eating excess beans takes longer and leaves no room for dessert.
Unfinished cans in the refrigerator tend to get pushed to the back and go moldy.
Very few people like cold beans for leftovers. (actually – sometimes I do)
I’m a huge fan of “patterns” or what I describe as “pattern thinking”. My main source of inspiration was not “design patterns” but rather Mary-Lynn Manns & Linda Rising’s book “Fearless Change“.
Whilst I’m no expert at developing my own patterns, the concept of planting a seed – a verbal cue or anchor – to encapsulate a powerful concept in a couple of words is incredibly valuable when coaching and leading teams and managers.
2 Great examples of this that aren’t mine are “Technical Debt” and “Code Smells”. Terms that people can latch onto quickly and use in conversation with generally little problem in being understood.
As a line manager a few years ago I required every member of my team to read Steve McConnell’s white paper on managing Technical Debt. Whilst he wasn’t the inventor, his treatment of the subject was a detailed and resonant enough introduction for it to stick with the teams. The term technical debt is now heavily used (and usually properly understood) all the way up to exec level within the group.
I was recently privileged enough to have Naresh Jain visit my site to coach TDD & refactoring. In a week of training he effectively introduced our entire group to the very sticky term “Code Smells“.
I’ll be writing up and sharing some of my own verbal seeds shortly. I doubt they’re unique but they’re how I choose to socialize specific thoughts, ideas & behaviors from my own experiences.