In the fast-growing software market today, the requirements for quality are growing as well. Also, people expect developers to design apps faster than ever. The use of a flexible architecture and various design techniques can certainly boost the quality to satisfy the end-user. As for formal quality criteria like code metrics, they are still relevant.
With new techniques such as extreme programming or Scrum, development can be done more quickly, and the availability of new platforms and abstraction from the lower levels allow avoiding many mistakes. Nevertheless, quality control should be carried out at a variety of levels – from the methodological to technological level, when quality control processes proceed in automatic mode (e.g., during automatic project builds). However, any control presupposes the presence of metrics that allow you to assess the achievement of the desired application quality.
Experts divide software metrics into several groups to understand which factors to consider while improving the quality.
Some indicators fall into several categories instead of a single one.
Table of Contents
What Are the Software Quality Metrics?
So, why do the categories mentioned above matter? Those are metrics used to concentrate on the quality of the applications. Here is what you have to consider:
- Level of product quality
- Quality indicators in the process
- Quality of service metrics
To evaluate the quality, it’s necessary to take into account both external and internal metrics. The first group contains features that can be visible to the eye. In the second category, those are traits visible just to the developers. External factors involve credibility and functionalities that establish the presence and correctness of the product feature implementation. They also include maintenance necessary to measure product resources, such as speed, memory, and environment). External factors also include the applicability of the product – how available for study and use this product is. Finally, this category is about the value of the created product.
As for the internal factors, those are the size and complexity of the product in the first turn. Add style metrics that are used to define approaches and technologies for creating individual components of the product and its documents. It’s vital to decide on all metrics prior to the development itself. The indicators should be included in the project’s requirements and discussed by all team members to make sure that everyone understands their roles.
Product metrics are often described by a set of models to establish various properties, quality model values, or predictions. Measurements are usually taken after calibration of metrics in the early stages of the project. A general measure is the degree of traceability, which is determined by the number of traces traced using UML scenario models and the estimated number of:
- Scenarios and participants
- The objects included in the script
- Parameters and operations of the object, etc.
A special measure is the level of use of reusable components. It is the ratio of the product’s size – finished components to the size of the system as a whole. This measure is also used in determining the cost and quality of software. Examples of metrics:
- Total number of objects and number of reusables
- Total number of operations, both reused and new operations
- The number of classes that inherit specific operations
- The number of classes on which a given class depends
- Number of class or operation users
As a rule, measures are largely subjective and depend on the knowledge of experts who make quantitative assessments of the attributes of the software’s components.
An example of widely used external program metrics are Halstead metrics, which are characteristics of programs that are determined based on the static structure of a program in a particular programming language: the number of occurrences of the most common operands and operators; the length of the program described as the sum of the number of occurrences of all operands and operators, etc.
Based on these attributes, you can calculate the programming time, the level of the program (structuring and quality) and the programming language (abstractions of language tools and focus on the problem), etc.
Process metrics can be development time, a number of errors found during the testing phase, etc. In practice, the following process metrics are used:
- Total development time and separate time for each stage
- Modification time of models
- Time of work on the process
- The number of errors found during the inspection
- The cost of quality control
- The cost of the development process
Usage metrics are used to measure the degree of satisfaction of the user’s needs in solving his problems. They help to assess not the properties of the program itself, but the results of its operation – the operational quality. An example is the accuracy and completeness of the implementation of user tasks, as well as the resources spent (labor, productivity, etc.) to effectively solve the user’s problems. Assessment of user requirements is carried out using external metrics.
What Are the Main Code Metrics?
A software metric is a numerical measure that allows you to evaluate certain properties of a particular section of program code. For each metric, there are usually its reference indicators, indicating at what extreme values it is worth paying attention to this part of the code.
The simplest metric to understand – the number of lines of code in a software system – although it is elementarily calculated, in conjunction with other metrics can serve to obtain formalized data for code evaluation. For example, you can build a relationship between the number of lines of code in a class and the number of methods/properties in a class by obtaining a characteristic that shows how large the methods of that class are.
Code metrics are an important tool and are already used by many software vendors today. For example, when certifying to higher levels under the ISO/IEC or CMM/CMMI models, the use of code metrics is mandatory, which allows achieving a certain degree of controllability of the development process.
There are many different classifications of software metrics, treating metrics from different positions and ranking the same characteristics by different criteria. One of these classifications can serve as the division of metrics into groups by subjects of assessment:
- Size – a comparative assessment of software sizes;
- Complexity – evaluation of the architecture and algorithms of the software system, as well as bug detection;
- Maintainability – assessment of the potential of the software system for subsequent modification.
Of course, there are other groups that are not included in this classification, for example, user satisfaction metrics or indicators of compliance with initial requirements.
Code Analysis Tool
Microsoft developers can take advantage of Visual Studio 2008, which allows you to compute a basic set of core metrics and track them in real time (See Figure 2). However, the primary use case for metrics is to inform repososible staff members whether project’s quality may have declined or improved. Therefore, it makes sense to calculate such metrics during the project build process.
Visual Studio 2008 and Microsoft Build do not allow you to build a serious hierarchy of metrics, and you should use other tools, such as NDepend, which allows you to use the . NET calculates different types of connectivity, inheritance and abstraction, integrating into the process of creating programs according to the initial instructions and business goals.
Sure thing, there are some problems using code metrics. First and foremost, they are not fully accurate. They are not able to provide an objective picture of the state of the software system, but only give out indicators that are calculated according to a given algorithm. Second, the measurement process can be artificially distorted by employees “optimizing” their code so that metrics produce better results. In addition, the formal use of metrics does not take into account the experience of employees, the level of the company and can bring not only benefit, but also harm.
Nevertheless, metrics are quite a useful tool in the hands of experts responsible for app and web development, allowing them to detect the gaps. It helps to determine when development has gone to a lower qualitative level and recognize the most complex areas in the system. The definition of numerical indicators can provide new information about the product being developed and help to more competently plan the costs for its further development.