June 20, 2010
Codemanship's Code Smell Of The Week - Duplicate Code (Part I)Okay, so "of the the week" is probably a bit misleading. But it's a snappier title than "every few days, when I get a free 5 minutes"...
This time, it's some simple duplicate code I'm tackling. Two almost identical methods in the same class are refactored into a shared helper method and two method calls. Easy peasy, but we've all got to start somewhere.
Next week, I'll refactor a different kind of code duplication caused by copy-and-paste inheritence. Yeah, you know who you are!
If you want to get together with 15 others, all hungry to learn refactoring from a veteran of the Dark Arts (yes, I do mean me) then keep an eye out for announcements about a budget-friendly weekend master class on this very blog in the next couple of days.
For expert training and coaching on refactoring, test-driven development and software craftsmanship, go to http://www.codemanship.com
Posted 8 years, 6 months ago on June 20, 2010