How much time did you spend in the debugger today?
Here is a question, how much time did you spend in the debugger today?
Lets say for a 10 hour project you spend on average 1 minute of every hour in the debugger. Of course this is a guess, if your writing code from scatch then you won't spend as often in the debugger as you aready have a mental note of where you need to set watches and breakpoints. Come back to that code in 6 months or debug someone elses code and you will be spending a lot longer trying to set breakpoints, stepping over/through etc. Even with user requirements helping point you in the right direction it will take time to figure out whats going on (and with out user requirements it's even more puzzle solving time).
Those that unit test there code, agile or otherwise will likely be saying I have spent less than a minute to no time at all in the debugger today. They will have had the inital time hump of learning what the code is doing, but it's likely a good set of user requirements and concrete set of tests allowed them to zero in on an area of functionality a lot faster than a trip with the debugger would. Further more, with the tests telling the developer what the code is supposed to do in accordance with the user requirements of the system, a developer can change\refactor the code with out fear of introducing new bugs or breaking the code completly (and changing the code in a tool like VS with td.net is zero friction, refactor, right click on the test method, run, green move to the next change, red go fix and repeat - before you commit). Refactoring with out effective regression is like swimming with sharks with your arm hanging off).
But I get ahead of my self, 10 minutes in the debugger out of your 10 hour project. Lets say that for every hour writing code you spend that 10 minutes writing tests instead. You can still find and eliminate bugs as you go, but you're also spending the time making sure that the tests for your code are automated and repeatable. Lets now say that 6 months on someone else has 1 hour of refactoring to make on the project. According to our average thats 1 minute in the debugger, but given that this person has never seen the code before it will likely be longer. However with our automated regression suite, it's likely going to take only a few seconds to run the tests and see if anything is broken, on average the developer is saving time. If the developer adds bugs through regression failures or spends time figuring out the code then this time scale goes up.