For years refactoring software has been a common process used to improve the quality, efficiency, and maintainability of an application. However, a recent article by IT World discusses how CIOs may not be getting a valuable return on their investment of time and effort into the refactoring process. While many believe refactoring reduces the risk of future headaches, new findings acquired through a study by Sri Lanka researchers suggests code quality is not improved significantly by refactoring.
What is Refactoring?
Code refactoring is the process of restructuring the current code of a program without affecting the external behavior of the application. The proposed advantages of this process are improved readability, decreased complexity, and increased maintainability. By taking the time to refactor, the source code becomes easier to manage, as future changes are needed.
The study referenced by this article had one specific objective: determining if traditional refactoring techniques provided measurable results for improved quality. External and internal quality was assessed to evaluate code maintainability as well as the number of code lines being managed. According to IT World, a small application consisting of 4500 lines of C sharp code was assessed using 10 typical refactoring techniques.
As part of this study, refactored and un-refactored code was analyzed to determine quality based on execution time, resource utilization and quality measurements. Study findings showed that the refactored code actually scored lower in regards to analyzability; however, the difference in statistics was minimal. According to the study, refactoring does not:
- code easier to change or update.
- Make the application run faster.
- Result in reduced utilization of resources.
However, the findings* did show refactoring makes the code easier to maintain in the long run. Refactored code had a higher rate on the maintainability index. Other internal measures used to determine quality such as Cyclomatic complexity and lines of code did not show a noticeable difference statistically.
How Do Metrics Help?
Quality metrics are frequently used to identify defects, assess productivity and identify areas of improvement within applications. It is a known fact that less complex code is easier to maintain. Additionally, code quality plays a role in amount of effort required to manage an application. Identifying problems within an application’s code base and assessing its complexity are key components to reducing the cost and effort required to maintain an application.
Traditionally, these metrics are used at the code level to identify defects or overly complex code and make the necessary fixes. However, metrics such as function points can be more valuable when they are performed at the system level. For example, these measurements can be used to assess the following:
- Software Size
- Cost Effectiveness
- Overall Quality
The information gained from these metrics helps companies determine if an application is worthwhile to maintain, needs to be modified or should be replaced. Code quality metrics are essential to identifying sources of technical debt, complexity and defects within code. When used to assess applications at the system level, these measurements make it possible to achieve forward-thinking infrastructure changes rather than simple code level modifications.
Journal of Software Engingeering & Applications (IJSEA), Vol. 6, No. 1, January 2015 https://arxiv.org/ftp/arxiv/papers/1502/1502.03526.pdf
Erik Oltmans, an Associate Partner from EY, Netherlands, spoke at the Software Intelligence Forum on how the consulting behemoth uses Software Intelligence in its Transaction Advisory services.
Erik describes the changing landscape of M & A. Besides the financial and commercial aspects, PE firms now equally value technical assessments, especially for targets with significant software assets. He goes on to detail how CAST Highlight makes these assessments possible with limited access to the targetâ€™s systems, customized quality metrics, and liability implications of open source components - all three that are critical for an M&A due diligence.