{"id":22,"date":"2006-04-21T07:31:38","date_gmt":"2006-04-21T15:31:38","guid":{"rendered":"http:\/\/jaredrobinson.com\/blog\/?p=22"},"modified":"2006-04-21T07:31:38","modified_gmt":"2006-04-21T15:31:38","slug":"refactoring-rules","status":"publish","type":"post","link":"https:\/\/jaredrobinson.com\/blog\/refactoring-rules\/","title":{"rendered":"Refactoring Rules"},"content":{"rendered":"<div class=\"wikitext\">\n<p class=\"tightenable top bottom\">Tried-and-true refactoring rules:<\/p>\n<ol>\n<li class=\"tightenable top bottom\">Find the smallest change that could possibly work, and check it in. &#8220;If I make this change, it will change nothing else.&#8221;<\/li>\n<li class=\"tightenable top bottom\">Revert early, and revert often. If you lose a half-day of work because the refactoring change is too large, that&#8217;s okay. Better to start over than to cost the rest of the team precious time struggling with a broken build.<\/li>\n<li class=\"tightenable top bottom\">Do <strong>not<\/strong> write new code while refactoring.<\/li>\n<li class=\"tightenable top bottom\">Always use cut-and-paste, never copy-and-paste.<\/li>\n<li class=\"tightenable top\">Just because the unit tests pass, doesn&#8217;t mean that the product still works after your refactor. You may need to add new unit tests before you refactor. And you may need to do some acceptance-testing for things that aren&#8217;t unit-testable.<\/li>\n<\/ol>\n<p class=\"tightenable bottom\">General Advice:<\/p>\n<ol>\n<li class=\"tightenable top\">Don&#8217;t checkin changes to the version control system just before you go home. Wait for the next day.<\/li>\n<\/ol>\n<p class=\"tightenable bottom\">Types of Refactoring:<\/p>\n<ol>\n<li class=\"tightenable top bottom\">Refer to Martin Fowler&#8217;s &#8220;Refactoring&#8221; book<\/li>\n<li class=\"tightenable top bottom\">Refer to Fowler&#8217;s website: <a class=\"namedurl\" href=\"http:\/\/www.refactoring.com\/\"><span style=\"white-space: nowrap\">http:\/\/www.refactoring.com\/<\/span><\/a> and his <a class=\"namedurl\" href=\"http:\/\/www.refactoring.com\/catalog\/index.html\"><span style=\"white-space: nowrap\">catalog<\/span> of refactorings<\/a><\/li>\n<\/ol>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Tried-and-true refactoring rules: Find the smallest change that could possibly work, and check it in. &#8220;If I make this change, it will change nothing else.&#8221; Revert early, and revert often. If you lose a half-day of work because the refactoring change is too large, that&#8217;s okay. Better to start over than to cost the rest &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/jaredrobinson.com\/blog\/refactoring-rules\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Refactoring Rules&#8221;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,17],"tags":[],"class_list":["post-22","post","type-post","status-publish","format-standard","hentry","category-programming","category-tech"],"_links":{"self":[{"href":"https:\/\/jaredrobinson.com\/blog\/wp-json\/wp\/v2\/posts\/22","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jaredrobinson.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jaredrobinson.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jaredrobinson.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/jaredrobinson.com\/blog\/wp-json\/wp\/v2\/comments?post=22"}],"version-history":[{"count":0,"href":"https:\/\/jaredrobinson.com\/blog\/wp-json\/wp\/v2\/posts\/22\/revisions"}],"wp:attachment":[{"href":"https:\/\/jaredrobinson.com\/blog\/wp-json\/wp\/v2\/media?parent=22"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jaredrobinson.com\/blog\/wp-json\/wp\/v2\/categories?post=22"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jaredrobinson.com\/blog\/wp-json\/wp\/v2\/tags?post=22"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}