Today a colleague was looking for a TDD poster that showed Red-Green-Refactor with detailed emphasis on Refactoring. We found a diagram that simply said "refactoring = removing duplication". This got be thinking about a post by JB Rainsberger in which he said: "...if you master removing duplication and fixing bad names, then I claim you master object-oriented design." (If you see this, JB, do you still make this claim?)
There are lots of kinds of duplication, and JB's assertion makes sense to me especially when I think about the kind of informational duplication (as opposed to code duplication) that DRY is intended to avoid.
I do still make the claim you quoted. I also believe that removing duplication (first code, then data) can teach the average person more than enough about improving design to reach the critical mass it takes to learn and master the larger principles of good modular design.
ReplyDeleteI would not say that refactoring is only removing duplication. That claim seems filled with optimism. As a Novice rule, though, it might work well.
Go read the original c2.com wiki page on TestDrivenDevelopment again. Look at the first description of TDD. It might surprise you.