Recently Bob Marshall opined that refactoring code is waste. This reminds me of passionate discussions from a decade ago about testing: should we classify testing as a value-added activity or as an unavoidable waste? I’d like to change the question a little, but first, allow me to play the ball where it lies.
This is a companion discussion topic for the original entry at http://blog.thecodewhisperer.com/permalink/musings-on-refactoring-as-waste
I tend to take it all with a big pinch of salt. Any argument that starts with "if we could get it right first time" is entirely theoretical. Evolutionary design is intrinsically wasteful. I'll take "effective" over "efficient" any day :)
How much time should one spend thinking, planning, and designing before "Getting it right first time"? :-/
I had assumed Bob's article to be a troll. I tried engaging on twitter (https://twitter.com/kevinru... but then gave it up as waste.
I think (I hope!) we all agree that we should spend some time thinking and that once we start writing code, we learn things that contradict the ideas we had when thinking. Now we come down to the question of how much time to think before writing code, which I genuinely believe amounts to a matter of style, and I don't dictate style.
Programmers will always make some design decisions before writing the first line of code. If you put two programmers together, one will want to start writing code before the other. It becomes a negotiation.
I teach TDD and evolutionary design through refactoring in order to show programmers that they don't have to do it all in their heads. How much they subsequently choose to do in their heads and through code becomes their choice.
I don't mind reminding programmers to treat evolutionary design as a tool, rather than as a ritual. Sometimes, even I spend time thinking about code before I write it.