RandalsRule is a debugging rule that holds true so often it must be a pattern. ''Most bugs are fixed just by deleting code''. (i.e. not adding any) Origin is from my boss who told me it years ago and I laughed, then years passed and it's no longer funny, just ironic. Specific examples: * Some code is duplicated needlessly and should simply be removed, not refactored * Some shops distribute Debug versions to customers for improved on-site diagnostics. Sometimes a Release version is distributed that had different compiler flags - a significant difference from the Debug version. Simply deleting the Release version from the project fixes the "bad version" Really this is one of those rules that seems insane until you've heard it, then you start to notice it everywhere. -- LayneThomas ---- Addendums: I just revisited this pattern in a project where I fixed a redraw problem by deleting all the HideWindow functions except one(no chokepoint, just call removals). An AhHa moment happened when I realized this is just OnceAndOnlyOnce from a different angle. The bug was caused by having excessive (and redundant) code - most certainly a CodeSmell, and in this case it developed into a legitimate bug. It seems RandalsRule is a pattern with the context of when violating OnceAndOnlyOnce causes a bug. Seems so obvious now. . . ''As a corollary; if you find that RandalsRule doesn't hold for your project or organization, you might be religiously applying OnceAndOnlyOnce already.'' Unless refactoring a legacy system where you should apply it liberally. . . ---- Another addendum: This rule seems to apply when writing new code as well. A complicated if, else, elseif block can sometimes be reduced to just one or two lines. Trite Example: if (default) { a=2; b=3; } else { a=2; b=5; } could be reduced to: a=2; b=3; if (!default) { a=2; b=5; } or even more extreme as: a=2; b=3; if (!default) b=5; This is admittedly a trite example, but hopefully makes the point that RandalsRule is an example of the OnceAndOnlyOnce pattern.