I just realized that TDD is a great way to pick up where you left off when you have distractions. There's a lot of articles about how programmers need four hours of continuous distractions-free time to get into "the zone" to get anything done. Well, that's kind of hard to do when you're trying to work from home and you have a little kid.
So here's my situation - I was trying to implement a somewhat complicated domain model while at home one Saturday morning, but sometimes someone would bring the kid over to me - once he was getting bored, and another time his room was getting cleaned. So I played with the kid for about half-an-hour each time. I also had to stop for breakfast.
I found that I could quickly pick up where I left off simply by going back to the last unit test I was working on. Certainly the test failures and compilation errors you get as part of the TDD process helps you focus on what you need to do immediately. It's like a notepad to keep track of where you are, only better!
I've always considered TDD as my favorite Agile practice. Today just reinforces that even more!
No comments:
Post a Comment