The Boy Scout Rule

From WikiContent

Revision as of 23:36, 19 November 2008 by Unclebob (Talk | contribs)
Jump to: navigation, search

The Boy Scouts have a rule. "Leave the campground cleaner than when you entered it." What if we followed this rule with our code? What if we always checked in the code cleaner than when we checked it out. If we did that then the software would get cleaner and cleaner over time. It wouldn't rot, and grow ever more tangled. Given that bad code slows us down so horribly, don't you think that following the boyscout rule is simply a matter of common decency?

When was the last time you were significantly impeded by bad code? It was probably recently. What do we do to prevent bad code from slowing us down in the future? We clean it.

Every time you check a module out, do some small bit of refactoring to clean that module so that it's better than when you checked it out. It doesn't matter how much cleaning you do, so long as you utterly refuse to check in a module any worse t when it was checked out. If you, and everyeone else on the team simply make a series of small improvements without making worse messes, then over time the system will be very clean.

by Uncle Bob

This work is licensed under a Creative Commons Attribution 3


Back to 97 Things Every Programmer Should Know home page

Personal tools
{"cc_re__cc_re__cc_by_3_0_us": ["all bit of refactoring to clean that module so that it's better than when you checked it out.  It doesn't matter how much cleaning you do, so long as you utterly refuse to check in a module any worse t when it was checked out.  If you, and everyeone else on the team simply make a series of small improvements without making worse messes, then over time the system will be very clean.\n</p><p>by <a href=\"/wiki/index.php/Uncle_Bob\" title=\"Uncle Bob\">Uncle Bob</a>\n</p><p>This work is licensed under a\n<a href=\"http://creativecommons.org/licenses/by/3.0/us/\" class=\"external text\" title=\"http://creativecommons.org/licenses/by/3.0/us/\" rel=\"nofollow\">Creative Commons Attribution 3</a> \n</p><p><br />\nBack to <a href=\"/wiki/index.php/97_Things_Every_Programmer_Should_Know\" title=\"97 Things Every Programmer Should Know\">97 Things Every Programmer Should Know</a> home page\n</p><div class=\"printfooter\">\nRetrieved from \"<a href=\"http://commons.oreilly.com/wiki/index.php/The_Boy_Scout_Rule\">http://commons.oreilly.com/wiki/index.php/The_Boy_Scout_Rule</a>\"</div>\n\t\t\t\t\t\t<!-- end content -->\n\t\t\t<div class=\"visualClear\"></div>\n\t\t</div>\n\t</div>\n\t\t</div>\n"]}