{"id":4085,"date":"2016-07-13T19:35:57","date_gmt":"2016-07-13T22:35:57","guid":{"rendered":"http:\/\/blog.plataformatec.com.br\/?p=4085"},"modified":"2018-09-24T14:48:23","modified_gmt":"2018-09-24T17:48:23","slug":"key-points-to-consider-when-doing-a-big-software-refactoring","status":"publish","type":"post","link":"https:\/\/blog.plataformatec.com.br\/2016\/07\/key-points-to-consider-when-doing-a-big-software-refactoring\/","title":{"rendered":"Key points to consider when doing a big software refactoring"},"content":{"rendered":"
Doing a big software refactor1<\/a><\/sup> is not a simple thing. There are lots of points that you should think about, from planning and prioritizing to team motivation and execution. Understanding these points in a structured and clear way is part of the job. The good news is that we\u2019ve been in that situation before and have learned the key points you should worry about.<\/p>\n Here are the main points you should consider when planning and executing a big refactoring process.<\/p>\n A big software refactoring process should not be started without clear business goals, otherwise it can suffer from a lack of commitment by your stakeholders. Here are some examples of goals:<\/p>\n By its very nature, a software refactoring process is a technical effort, which is why it’s common for people not to measure its progress in the same structured way that they measure progress on development of new features. Don’t fall into that trap.<\/p>\n As with every task in a project, a refactor should always be planned and measured<\/a>.<\/p>\n Working on a legacy codebase can be demotivating for developers, especially if they don’t have a feeling of progress, or if they don’t know when it’s going to end. When going with a refactoring process, you should keep this in mind.<\/p>\n Show your team they’re moving forward. Plan for small deliverables, so that you can continually ship stuff and celebrate the good work done. Also, think about developer rotation, which can help by maintaining motivation and keeping fresh eyes on the task.<\/p>\n Are you going to improve your codebase only when touching some bad part of it, or are you going to proactively choose which parts you’re going to improve?<\/p>\n If you have a clear business goal, it’s easier to proactively choose which parts need to be improved to make that goal a reality. With the parts listed, you can apply your usual prioritization techniques.<\/p>\n But if you’re going to do a constant and big software refactor because you know the whole codebase needs to be improved, it’s more difficult to prioritize. This is because there are not just one or two main parts that need improvement, but lots of them. It’s difficult to know where to start.<\/p>\n One way to prioritize in that situation is to instruct your team to evaluate which parts need to be refactored based on their complexity and churn. By that we mean, whenever they are evaluating if some part of the code should or should not be refactored, they should ask themselves:<\/p>\n If the answers are both yes, that part is a good candidate for refactoring. Plot a chart of “class complexity X churn” and prioritize the parts that are too complex and that you’re changing every time.<\/p>\n The parts that have big complexity but don’t need to change constantly are not good candidates to be refactored because they’re parts that are ugly but usually work, and nobody needs to change them to do their everyday job.<\/p>\n A software refactoring process can turn into an endless endeavor if you don’t plan, prioritize and measure progress. You should treat it as a project. It should have a beginning, a middle and an end.<\/p>\n Your refactoring process should improve stuff that is already working without breaking anything. Make sure you have good test coverage, otherwise the process can generate more bugs than quality improvements.<\/p>\n If your test suite is too slow, it will slow down the refactoring process since a software refactor is greatly based on continuously running the tests. Make sure the test suite performance is not a bottleneck.<\/p>\n A refactoring process can take a long time: weeks, months. During that time the velocity in which new features are delivered will be compromised. Make sure that every business stakeholder understands the goals and the nature of that kind of work, so that they don’t give up in the middle of it.<\/p>\n What about you? Do you have any more tips on what to worry about when doing a big software refactor? Share with us!<\/p>\n The second post of Low Internal Software Quality series. Doing a big software refactor1 is not a simple thing. There are lots of points that you should think about, from planning and prioritizing to team motivation and execution. Understanding these points in a structured and clear way is part of the job. The good news … \u00bb<\/a><\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"ngg_post_thumbnail":0,"footnotes":""},"categories":[1],"tags":[205,217,15],"aioseo_notices":[],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/blog.plataformatec.com.br\/wp-json\/wp\/v2\/posts\/4085"}],"collection":[{"href":"https:\/\/blog.plataformatec.com.br\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.plataformatec.com.br\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.plataformatec.com.br\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.plataformatec.com.br\/wp-json\/wp\/v2\/comments?post=4085"}],"version-history":[{"count":15,"href":"https:\/\/blog.plataformatec.com.br\/wp-json\/wp\/v2\/posts\/4085\/revisions"}],"predecessor-version":[{"id":7798,"href":"https:\/\/blog.plataformatec.com.br\/wp-json\/wp\/v2\/posts\/4085\/revisions\/7798"}],"wp:attachment":[{"href":"https:\/\/blog.plataformatec.com.br\/wp-json\/wp\/v2\/media?parent=4085"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.plataformatec.com.br\/wp-json\/wp\/v2\/categories?post=4085"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.plataformatec.com.br\/wp-json\/wp\/v2\/tags?post=4085"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}Define your business goals<\/h3>\n
\n
Measure progress<\/h3>\n
Pay attention to your team’s motivation<\/h3>\n
Define your approach: pull or push?<\/h3>\n
Prioritizing<\/h3>\n
\n
Know when you’re done<\/h3>\n
Test suite coverage<\/h3>\n
Test suite performance<\/h3>\n
Sponsors commitment<\/h3>\n
Posts of the Low Internal Software Quality series<\/h4>\n
\n
\n\n
\n","protected":false},"excerpt":{"rendered":"