[Laws] John Tobler's "Three Strikes" Refactoring Rule
So many lines of code written in various languages for so many systems in so many industries; so many reworked programs, procedures, methods, and classes; so many code reviews -- finally, I have boiled down one of my pet peeves into another rule statement that I can claim as my own. Here is
John Tobler's "Three Strikes" Refactoring Rule:
"Refactor to avoid mindless repetition; if you have done the same thing three times within a single context, find a better way!"
Restatement of John Tobler's "Three Strikes" Refactoring Rule:
"If you have done the same thing more than three times within a single context, you have incarcerated yourself and your company in a mental prison for the rest of your natural (or unnatural) lives."