{"id":238,"date":"2018-11-02T14:50:39","date_gmt":"2018-11-02T14:50:39","guid":{"rendered":"http:\/\/fip.r-a-w.org\/?page_id=238"},"modified":"2018-11-02T14:55:57","modified_gmt":"2018-11-02T14:55:57","slug":"refactoring-code-checklist","status":"publish","type":"page","link":"https:\/\/fip.r-a-w.org\/?page_id=238","title":{"rendered":"Refactoring Code Checklist"},"content":{"rendered":"<ul>\n<li>Can the code be refactored?\n<ul>\n<li>Do you need a seam?\n<ul>\n<li>extract methods using protected not private that use the seam.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li>Create Tests<\/li>\n<li>Start with the deepest branch to shortest branch<\/li>\n<li>Keep changes small and consistently retest.<\/li>\n<li>Remove complexity<\/li>\n<li>Methods should not have more than 10 lines of code<\/li>\n<li>Replace conditionals with strategy pattern.<\/li>\n<li>Remove local variables<\/li>\n<li>Remove comments &#8211; use descriptive method names.<\/li>\n<li>Remove cryptic or clever code,<\/li>\n<li>Remove abbreviated code<\/li>\n<li>Refactor with dependency injection<\/li>\n<li>Refactor using SOLID\n<ul>\n<li>\n<div>Single Responsibility Principle (SRP)<\/div>\n<\/li>\n<li>\n<div>Open Closed Design Principle<\/div>\n<\/li>\n<li>\n<div>Liskov Substitution Principle (LSP)<\/div>\n<\/li>\n<li>\n<div>Interface Segregation Principle<\/div>\n<\/li>\n<li>\n<div>Dependency Inversion Principle<\/div>\n<\/li>\n<\/ul>\n<\/li>\n<li>Refactor using other design principles\n<ul>\n<li>\n<div>Encapsulate what changes<\/div>\n<\/li>\n<li>\n<div>Don\u2019t Repeat Yourself (DRY)<\/div>\n<\/li>\n<li>\n<div>Don&#8217;t look for things. Ask for things. (Dependency Injection)<\/div>\n<\/li>\n<li>\n<div>Favor Composition over Inheritance<\/div>\n<\/li>\n<li>\n<div>Program to the Interface not to the Implementation<\/div>\n<\/li>\n<li>\n<div>Delegation Principles<\/div>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>Last updated 2\/11\/18<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Can the code be refactored? Do you need a seam? extract methods using protected not private that use the seam. Create Tests Start with the deepest branch to shortest branch Keep changes small and consistently retest. Remove complexity Methods should not have more than 10 lines of code Replace conditionals with strategy pattern. Remove local &hellip; <a href=\"https:\/\/fip.r-a-w.org\/?page_id=238\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Refactoring Code Checklist<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":241,"parent":191,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-238","page","type-page","status-publish","has-post-thumbnail","hentry"],"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/P9NvWe-3Q","jetpack_likes_enabled":true,"jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/fip.r-a-w.org\/index.php?rest_route=\/wp\/v2\/pages\/238","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fip.r-a-w.org\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/fip.r-a-w.org\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/fip.r-a-w.org\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/fip.r-a-w.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=238"}],"version-history":[{"count":5,"href":"https:\/\/fip.r-a-w.org\/index.php?rest_route=\/wp\/v2\/pages\/238\/revisions"}],"predecessor-version":[{"id":244,"href":"https:\/\/fip.r-a-w.org\/index.php?rest_route=\/wp\/v2\/pages\/238\/revisions\/244"}],"up":[{"embeddable":true,"href":"https:\/\/fip.r-a-w.org\/index.php?rest_route=\/wp\/v2\/pages\/191"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/fip.r-a-w.org\/index.php?rest_route=\/wp\/v2\/media\/241"}],"wp:attachment":[{"href":"https:\/\/fip.r-a-w.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=238"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}