{"id":532,"date":"2023-03-21T21:44:38","date_gmt":"2023-03-22T01:44:38","guid":{"rendered":"https:\/\/freedville.com\/blog\/?p=532"},"modified":"2023-03-22T08:41:58","modified_gmt":"2023-03-22T12:41:58","slug":"book-review-reengineering-legacy-software","status":"publish","type":"post","link":"https:\/\/freedville.com\/blog\/2023\/03\/21\/book-review-reengineering-legacy-software\/","title":{"rendered":"Book Review: Re-Engineering Legacy Software"},"content":{"rendered":"\n<p>Developers are always looking for a shiny new toy but we spend most of our working lives working on \u201clegacy software\u201d.\u00a0 I\u2019m glad to see Chris Birchall tackle this important subject.\u00a0 He notes that most programming books talk about new projects but we need the most help working with legacy software.\u00a0 Hence, &#8220;<a href=\"https:\/\/www.manning.com\/books\/re-engineering-legacy-software\">Re-Engineering Legacy Software<\/a>&#8221; is a must read for any software developer.  Below are my favorite highlights and what they mean to me.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" loading=\"lazy\" width=\"700\" height=\"525\" src=\"https:\/\/freedville.com\/blog\/wp-content\/uploads\/2023\/03\/lance-grandahl-VSXT9AV19Is-unsplash-700x525.jpeg\" alt=\"Old home with junk\" class=\"wp-image-533\" srcset=\"https:\/\/freedville.com\/blog\/wp-content\/uploads\/2023\/03\/lance-grandahl-VSXT9AV19Is-unsplash-700x525.jpeg 700w, https:\/\/freedville.com\/blog\/wp-content\/uploads\/2023\/03\/lance-grandahl-VSXT9AV19Is-unsplash-300x225.jpeg 300w, https:\/\/freedville.com\/blog\/wp-content\/uploads\/2023\/03\/lance-grandahl-VSXT9AV19Is-unsplash-768x576.jpeg 768w, https:\/\/freedville.com\/blog\/wp-content\/uploads\/2023\/03\/lance-grandahl-VSXT9AV19Is-unsplash-1536x1152.jpeg 1536w, https:\/\/freedville.com\/blog\/wp-content\/uploads\/2023\/03\/lance-grandahl-VSXT9AV19Is-unsplash-2048x1536.jpeg 2048w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><figcaption class=\"wp-element-caption\">Figure 1 Building from scratch is fun, but can you do a fixer-upper? Photo by <a href=\"https:\/\/unsplash.com\/@lg17?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText\">Lance Grandahl<\/a> on <a href=\"https:\/\/unsplash.com\/photos\/VSXT9AV19Is?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText\">Unsplash<\/a><\/figcaption><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>First he defines legacy software as being:<\/p>\n\n\n\n<ul>\n<li><strong>Old<\/strong> \u2013 a few years old, and often having a few iterations of team members cycling through the project.<\/li>\n\n\n\n<li><strong>Large<\/strong> \u2013 successful software grows, often to the point of unwieldiness<\/li>\n\n\n\n<li><strong>Inherited<\/strong><\/li>\n\n\n\n<li><strong>Poorly documented<\/strong><\/li>\n<\/ul>\n\n\n\n<p>Sound like any software you know?<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" loading=\"lazy\" width=\"700\" height=\"393\" src=\"https:\/\/freedville.com\/blog\/wp-content\/uploads\/2023\/03\/valery-fedotov-CqX6IhVj2TI-unsplash-700x393.jpeg\" alt=\"Jenga tower\" class=\"wp-image-534\" srcset=\"https:\/\/freedville.com\/blog\/wp-content\/uploads\/2023\/03\/valery-fedotov-CqX6IhVj2TI-unsplash-700x393.jpeg 700w, https:\/\/freedville.com\/blog\/wp-content\/uploads\/2023\/03\/valery-fedotov-CqX6IhVj2TI-unsplash-300x168.jpeg 300w, https:\/\/freedville.com\/blog\/wp-content\/uploads\/2023\/03\/valery-fedotov-CqX6IhVj2TI-unsplash-768x431.jpeg 768w, https:\/\/freedville.com\/blog\/wp-content\/uploads\/2023\/03\/valery-fedotov-CqX6IhVj2TI-unsplash-1536x862.jpeg 1536w, https:\/\/freedville.com\/blog\/wp-content\/uploads\/2023\/03\/valery-fedotov-CqX6IhVj2TI-unsplash-2048x1150.jpeg 2048w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><figcaption class=\"wp-element-caption\">Figure 2 Are you afraid that one change will topple your legacy software? Photo by <a href=\"https:\/\/unsplash.com\/@imlst?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText\">Valery Fedotov<\/a> on <a href=\"https:\/\/unsplash.com\/photos\/CqX6IhVj2TI?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText\">Unsplash<\/a><\/figcaption><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>Worse, legacy software introduces <strong>fear of change<\/strong>.\u00a0 It\u2019s so hard to predict the impact of any new change that teams try to protect the status quo.\u00a0 (If it\u2019s not broken, don\u2019t change it.)\u00a0 Birchall writes that \u201cAny change is seen purely as a risk, and the potential benefits of changes are ignored.\u201d\u00a0 This contributes to a self-fulfilling prophecy \u2013 entropy wins, and the software keeps getting worse over time.  I&#8217;ve seen this happen so many times and it&#8217;s always frustrating.<\/p>\n\n\n\n<p>The pinnacle of this fear is assigned to \u201cdangerous\u201d areas of the code \u2013 those that are the least well understood, or buggiest, or most fragile, or other means.\u00a0 But rather than avoiding these sections of the code, Birchall suggests we run head-on into these sections.\u00a0 They are the areas needing the most help and our focus should be on improving them, not avoiding them.  We should improve the software and leave it better than we found it.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" loading=\"lazy\" width=\"700\" height=\"1057\" src=\"https:\/\/freedville.com\/blog\/wp-content\/uploads\/2023\/03\/shane-rounce-DNkoNXQti3c-unsplash-700x1057.jpeg\" alt=\"Many hands on a log\" class=\"wp-image-535\" srcset=\"https:\/\/freedville.com\/blog\/wp-content\/uploads\/2023\/03\/shane-rounce-DNkoNXQti3c-unsplash-700x1057.jpeg 700w, https:\/\/freedville.com\/blog\/wp-content\/uploads\/2023\/03\/shane-rounce-DNkoNXQti3c-unsplash-199x300.jpeg 199w, https:\/\/freedville.com\/blog\/wp-content\/uploads\/2023\/03\/shane-rounce-DNkoNXQti3c-unsplash-768x1160.jpeg 768w, https:\/\/freedville.com\/blog\/wp-content\/uploads\/2023\/03\/shane-rounce-DNkoNXQti3c-unsplash-1017x1536.jpeg 1017w, https:\/\/freedville.com\/blog\/wp-content\/uploads\/2023\/03\/shane-rounce-DNkoNXQti3c-unsplash-1356x2048.jpeg 1356w, https:\/\/freedville.com\/blog\/wp-content\/uploads\/2023\/03\/shane-rounce-DNkoNXQti3c-unsplash-scaled.jpeg 1696w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><figcaption class=\"wp-element-caption\">Figure 3 Work together to fix the most &#8220;dangerous&#8221; parts of your code. Photo by <a href=\"https:\/\/unsplash.com\/es\/@shanerounce?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText\">Shane Rounce<\/a> on <a href=\"https:\/\/unsplash.com\/photos\/DNkoNXQti3c?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText\">Unsplash<\/a><\/figcaption><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>Refactoring is the best method to chip away at an unwieldy system and make it manageable.\u00a0 While Birchall suggests some techniques individuals can use to refactor parts of a legacy system he makes it clear that <strong>refactoring is a team sport<\/strong>.\u00a0 Without buy-in from most or all of the team, any individual refactoring efforts may lose out to inertia, or burn-out the refactoring developer.  His success stories are inspiring!<\/p>\n\n\n\n<p>The other technique for taming legacy software is adding test automation.&nbsp; This presents challenges when the legacy code is inherently untestable.&nbsp; A chicken-and-egg problem appears &#8211; refactor or automate tests first?&nbsp; Sometimes you need a small refactoring to be able to add test automation.&nbsp; This is ok, there are no hard-and-fast rules, except to work in manageable pieces and have team buy-in.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" loading=\"lazy\" width=\"700\" height=\"467\" src=\"https:\/\/freedville.com\/blog\/wp-content\/uploads\/2023\/03\/chris-lawton-9T346Ij4kGk-unsplash-700x467.jpeg\" alt=\"Old musty books\" class=\"wp-image-536\" srcset=\"https:\/\/freedville.com\/blog\/wp-content\/uploads\/2023\/03\/chris-lawton-9T346Ij4kGk-unsplash-700x467.jpeg 700w, https:\/\/freedville.com\/blog\/wp-content\/uploads\/2023\/03\/chris-lawton-9T346Ij4kGk-unsplash-300x200.jpeg 300w, https:\/\/freedville.com\/blog\/wp-content\/uploads\/2023\/03\/chris-lawton-9T346Ij4kGk-unsplash-768x512.jpeg 768w, https:\/\/freedville.com\/blog\/wp-content\/uploads\/2023\/03\/chris-lawton-9T346Ij4kGk-unsplash-1536x1024.jpeg 1536w, https:\/\/freedville.com\/blog\/wp-content\/uploads\/2023\/03\/chris-lawton-9T346Ij4kGk-unsplash-2048x1365.jpeg 2048w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><figcaption class=\"wp-element-caption\">Figure 4 Documentation from legacy software? Photo by <a href=\"https:\/\/unsplash.com\/@chrislawton?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText\">Chris Lawton<\/a> on <a href=\"https:\/\/unsplash.com\/photos\/9T346Ij4kGk?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText\">Unsplash<\/a><\/figcaption><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>Documentation is often out-of-date, Birchall has two key suggestions for keeping automation fresh:<\/p>\n\n\n\n<ul>\n<li><strong>Documentation lives with the code<\/strong>: \u201cREADME is the most important file in the repository\u201d.&nbsp; It\u2019s easy to update the documentation with the code when it can literally be done in the same Git workflow developers are already using for code changes.<\/li>\n\n\n\n<li><strong>(Automated) tests are the documentation<\/strong>: The tests literally describe how the software works \u2013 how to setup, execute, and verify expected behavior.&nbsp; If the tests are out of date the software may fail to build!<\/li>\n<\/ul>\n\n\n\n<p>At just over 200 pages this is a quick read that\u2019s jam-packed with useful insights.\u00a0 Highly recommended to anyone building or maintaining software systems!  Please check out <a href=\"https:\/\/www.manning.com\/books\/re-engineering-legacy-software\">Re-Engineering Legacy Software<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Developers are always looking for a shiny new toy but we spend most of our working lives working on \u201clegacy software\u201d.\u00a0 I\u2019m glad to see Chris Birchall tackle this important subject.\u00a0 He notes that most&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/freedville.com\/blog\/wp-json\/wp\/v2\/posts\/532"}],"collection":[{"href":"https:\/\/freedville.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/freedville.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/freedville.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/freedville.com\/blog\/wp-json\/wp\/v2\/comments?post=532"}],"version-history":[{"count":5,"href":"https:\/\/freedville.com\/blog\/wp-json\/wp\/v2\/posts\/532\/revisions"}],"predecessor-version":[{"id":543,"href":"https:\/\/freedville.com\/blog\/wp-json\/wp\/v2\/posts\/532\/revisions\/543"}],"wp:attachment":[{"href":"https:\/\/freedville.com\/blog\/wp-json\/wp\/v2\/media?parent=532"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/freedville.com\/blog\/wp-json\/wp\/v2\/categories?post=532"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/freedville.com\/blog\/wp-json\/wp\/v2\/tags?post=532"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}