Using Code Quality Metrics to Improve Application Performance

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.

Survey Says:

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
  • Complexity
  • Efficiency
  • 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

Get Your Free White Paper And Learn How Software Analysis Can Help Your Business

“The Science of IT Planning and Budgeting” helps senior leaders challenge the status quo and to understand how a research-based, automated solution transforms this important process by injecting it with fact-based, objective insight.

Your Information will be kept private and secure.