--Originally published at Hackerman's house
The podcast with Scott Hanselman and Kent Beck called test && commit || revert based on the idea previously posted in Kent Beck blog was really interesting as the idea they discussed was something a bit extreme to me, but it made kind of sense. The basic programming workflow is to program, then test the code and if it works you commit it, if it doesn’t work you have to erase everything you did until the last test was passed. The thing that I find extreme in this procedure is that as programmers (and humans) we don’t wan’t to throw what we did to the garbage. We usually prefer to fix what we did, and explore the same solution making minor adjustments.
Altought the first time Kent Beck heard of this idea he wasn’t really sure if it would work, he decided that he would give it a try. In this workflow the programmer can experiment really quick so you can quickly determine how comfortable you feel with this weird and different technique. The idea is really easy to understand, but it is not that simple to do it right, a complete change in mentality has to be made for this to work, the test should be made more often and have more inmediate goals, this way you won’t throw away a lot of time of work. Another thing to consider is that the code that passes a test usually can be improved, so if you pass a test you may require to take a look at your code to make sure it is robust enough.
To conclude I want to talk about my opinion of this programming workflow. I agree with some of the points exposed, and personally I may try to acquire the habit of testing little parts code, because in the past I had bad experiences where a lot of work would be thrown away due the lack of early testing. The part of fully reversing until the point of your previous tests seems kind of extreme. I rather make and effort to correct the code I already did than starting from scratch.