Software Quality Engineering - Software Metrics
Software Metrics
Use of Metrics
- Metrics are used to determine the quality of a current product or process.
- They help predict qualities of a product or process.
- Metrics assist in improving the quality of a product or process.
- Estimate the cost and schedule of future projects.
- Evaluate the productivity impacts of new tools and techniques.
- Establish productivity trends over time.
- Improve software quality.
- Forecast future staffing needs.
- Anticipate and reduce future maintenance needs.
Example Metrics
- Defect rates
- Error rates
- Measured by:
- Individual
- Module
- During development
- Errors should be categorized by origin, type, cost.
Definitions
- Measure: Quantitative indication of extent, amount, dimension, capacity, or size of some attribute of a product or process.
- Example: Number of errors.
- Metric: Quantitative measure of the degree to which a system, component, or process possesses a given attribute. It's a handle or guess about a given attribute.
- Example: Number of errors found per person-hours expended.
Metric Classification
- Products: Explicit results of software development activities, including deliverables, documentation, and by-products.
- Processes: Activities related to the production of software.
- Resources: Inputs into the software development activities, such as hardware, knowledge, and people.
Product vs. Process
- Process Metrics
- Provide insights into process paradigms, software engineering tasks, work products, or milestones.
- Lead to long-term process improvement.
- Product Metrics
- Assess the state of the project.
- Track potential risks.
- Uncover problem areas.
- Adjust workflow or tasks.
- Evaluate team's ability to control quality.
Types of Measures
- Direct Measures (Internal Attributes)
- Cost, effort, Lines of Code (LOC), speed, memory.
- Indirect Measures (External Attributes)
- Functionality, quality, complexity, efficiency, reliability, maintainability.
Size-Oriented Metrics
- Size of the software produced.
- LOC: Lines of Code
- KLOC: 1000 Lines of Code
- SLOC: Statement Lines of Code (ignore whitespace)
- Typical Measures:
- Errors/KLOC, Defects/KLOC, Cost/LOC, Documentation Pages/KLOC
LOC Metrics
- Easy to use.
- Easy to compute.
- Language & programmer dependent.
Complexity Metrics
- LOC is a function of complexity.
- Language and programmer dependent.
- Halstead’s Software Science (entropy measures):
- n1 - number of distinct operators
- n2 - number of distinct operands
- N1 - total number of operators
- N2 - total number of operands
Example
if (k < 2) {
if (k > 3)
x = x*k;
}
- Distinct operators: if ( ) { } > < = * ;
- Distinct operands: k 2 3 x
- n1=10
- n2=4
- N1=13
- N2=7
Halstead’s Metrics
- Amenable to experimental verification [1970s]
- Program length: N=N1+N2
- Program vocabulary: n=n1+n2
- Estimated length: =n1log<em>2n1+n2log</em>2n2 – Close estimate of length for well-structured programs
- Purity ratio: PR=/N
Program Complexity
- Volume: V=Nlog2n – Number of bits to provide a unique designator for each of the n items in the program vocabulary.
- Difficulty: (formula missing in original slides)
- Program effort: E=D∗V – This is a good measure of program understandability.
FURPS
- Functionality: Features of system
- Usability: Aesthetics, documentation
- Reliability: Frequency of failure, security
- Performance: Speed, throughput
- Supportability: Maintainability
Measures of Software Quality
- Correctness: Degree to which a program operates according to specification.
- Defects/KLOC
- Defect is a verified lack of conformance to requirements.
- Failures/hours of operation
- Maintainability: Degree to which a program is open to change.
- Mean time to change
- Change request to new version (Analyze, design etc.)
- Cost to correct
- Integrity: Degree to which a program is resistant to outside attack.
- Fault tolerance, security & threats
- Usability: Easiness to use
- Training time, skill level necessary to use, Increase in productivity, subjective questionnaire or controlled experiment.