The IDE compiler has been enhanced to provide developers better insight into the state of their code. The powerful Code Metrics Report provides a set of five measurements that help embedded engineers gain a better understanding of what aspects of their code could be potentially changed to improve maintainability and testability.
Number of Functions, Statements and Comments
Functions that are exceptionally large are potential candidates for refactoring. The IDE Compiler reports the number of functions, statements per function and comments. Embedded developers can use this information to rapidly identify large functions that may benefit from being broken down into a number of smaller, more maintainable functions.
Cyclomatic complexity is the number of independent paths through the code. Code with a higher value of cyclomatic complexity can be harder to test and maintain, since each path must be tested. The cyclomatic complexity is useful to both the developer and engineering project manager as it helps determine the number of test cases the code requires.
Halstead metrics are a well established method of measuring the size and complexity of source code. The IDE reports the Halstead Code Volume and Difficulty for each function in a project and for the project as a whole. Volume is a more sophisticated measure of code size than the number of lines of code and Difficulty measures the difficulty of writing or understanding the code. This measurement helps to justify time spent developing the code and effort to maintain it.
Time to Implement
The Halstead metrics are used to report Time to Implement, which represents the average amount of time it would take a developer to implement the code, given it's measured size and complexity.
The Maintainability Index combines several metrics, including Cyclomatic Complexity and Halstead Code Volume to report how maintainable code will be over time. It can help developers and engineering managers quantify and report software quality improvements to non-technical business executives.
The Code Metrics Report is just one of many productivity tools available to CCS IDE-Compiler owners with software download rights. To learn more about how code metrics can help improve embedded software quality and test coverage, go to www.ccsinfo.com/metrics.