Chapter 2
The basics of measurement
• Metrology
• Property-oriented measurement
• Meaningfulness in measurement
• Measurement quality
• Measurement process
• Scale
• Measurement validation
• Object-oriented measurement
• Subject-domain-oriented measurement
1
What is Measurement?
• Definition: Measurement is the process of assigning numbers or
symbols to attributes of entities in the real world in such a way that
they describe them according to clearly defined rules.
• In software engineering, measurement is used to quantify software
characteristics (like size, complexity, quality, effort, and performance).
• Example: Counting the number of lines of code (LOC) in a program.
2
Metrology
• What is Metrology?
• General Definition:
Metrology is the science of measurement, including the development
of measurement standards, techniques, and accuracy.
• In Engineering:
It ensures that measurements are consistent, reliable, and
comparable across different contexts.
3
Why Metrology Matters in Software?
• In physical sciences, metrology deals with measuring physical
quantities (length, mass, time).
In software engineering, metrology principles are applied to measure
intangible attributes such as:
• Size of code (LOC, Function Points).
• Complexity of algorithms.
• Quality factors (defects, reliability, maintainability).
4
Metrology in Software Metrics
• Measurement Standards: Define how metrics should be collected
(e.g., IEEE 1061 standard for software quality metrics).
• Accuracy and Reliability: Metrics should give consistent results across
projects and teams.
• Comparability: Enables organizations to benchmark productivity and
quality across projects.
5
Link to Software Metrics Basics
• Just like in metrology, software measurement requires:
• Entities → e.g., modules, processes.
• Attributes → e.g., size, reliability.
• Measurement rules → e.g., how to count LOC or classify defects.
• This ensures that metrics are valid, repeatable, and useful for
decision-making.
6
Property-Oriented Measurement
What it Means
• In measurement theory, property-oriented measurement focuses on measuring the
properties (attributes) of an entity rather than the entity itself.
• In software engineering, we can’t measure software directly (it’s intangible), but we
can measure its properties like size, complexity, effort, or reliability.
• Key Concepts
• Entity → The object of interest (e.g., a program, a module, or a development process).
• Property/Attribute → A characteristic of the entity (e.g., LOC = size, defect density =
quality).
• Measurement Mapping → Assigning numbers/symbols to the attribute following well-
defined rules.
7
Steps in Property-Oriented Measurement
• Identify the entity (e.g., source code).
• Select the property to measure (e.g., complexity).
• Define a measurement function (e.g., Cyclomatic Complexity
formula).
• Apply measurement rules consistently (e.g., follow IEEE standards).
• Interpret the measurement for decision-making.
8
Examples in Software Metrics
• Size Property → Measured by Lines of Code (LOC), Function Points.
• Complexity Property → Measured by Cyclomatic Complexity,
Halstead metrics.
• Quality Property → Measured by defect density, reliability,
maintainability index.
• Process Property → Measured by effort (person-hours), productivity.
9
Meaningfulness in Measurement
Definition
• A measurement is meaningful if the numerical values assigned to attributes correctly
represent the real-world properties they are supposed to measure.
• In other words: Does the number we assign truly reflect the property of the software we
care about?
Why It Matters in Software Metrics
• Software is intangible — we can’t physically measure it.
• If a metric doesn’t correspond to the real attribute (e.g., using LOC as a direct measure
of quality), it may lead to false conclusions.
• Ensures that metrics provide valid, useful, and interpretable information for decision-
making.
10
Levels of Meaningfulness (by Scale Type)
• Different scales of measurement affect what operations are meaningful:
• Nominal Scale → Only equality/inequality comparisons are meaningful.
• Example: Defect type (logic, syntax, runtime).
• Ordinal Scale → Rankings are meaningful, but not the size of differences.
• Example: Severity levels (High > Medium > Low).
• Interval Scale → Differences are meaningful, but ratios are not.
• Example: Calendar time (10 days vs 20 days → difference of 10 days is meaningful,
but “twice as long” is not).
• Ratio Scale → All arithmetic operations are meaningful (ratios, differences,
comparisons).
• Example: LOC, execution time, memory usage.
11
Examples in Software Metrics
• Meaningful Metric: Cyclomatic Complexity = 10 → tells us there are
10 independent execution paths (a true reflection of complexity).
• Potentially Misleading Metric: LOC = 5,000 → may suggest “larger
software,” but does not necessarily indicate higher quality or
functionality.
12
Measurement Quality
Definition
• Measurement quality refers to how well a measurement process and
its results reflect the true value of the property being measured.
• A high-quality measurement is accurate, consistent, and useful for
decision-making.
13
Key Characteristics of Measurement Quality
• Validity
• Does the metric actually measure what it claims to measure?
• Example: Using defect density (defects per KLOC) as a measure of software reliability.
• Reliability (Consistency)
• Will the measurement give the same results under consistent conditions?
• Example: Two people counting LOC in the same program should get the same value.
• Accuracy
• How close is the measurement to the actual (true) value?
• Example: Measuring response time correctly in seconds, not approximations.
• Precision
• The degree of detail in the measurement.
• Example: Reporting execution time as 2.34 seconds instead of “about 2 seconds.”
• Consistency
• The measurement method should produce repeatable and comparable results across
projects, teams, or tools.
• Practicality / Cost-effectiveness
• Measurement should not be so costly or time-consuming that it outweighs its usefulness. 14
Importance in Software Metrics
• Poor-quality measurement → misleading metrics → wrong decisions.
• High-quality measurement:
• Improves project planning & control.
• Provides a solid basis for quality assurance.
• Enables reliable benchmarking across projects and organizations.
15
Examples
• Good Quality Measurement: Cyclomatic Complexity using McCabe’s
formula → always produces the same result for a given program.
• Poor Quality Measurement: “Developer productivity” measured only
by LOC → misleading because it ignores quality, complexity, and
maintainability.
16
Measurement process
Definition
• The measurement process is the systematic set of activities used to
identify, collect, analyze, and interpret data about software entities
and their attributes to support decision-making.
17
Steps in the Measurement Process
• Define Measurement Goals
• Clarify why you are measuring (e.g., improve quality, estimate cost, track productivity).
• Example: Measure defect density to assess reliability.
• Select Entities and Attributes
• Choose the entity (e.g., source code, development process, test cases).
• Identify the attribute to be measured (e.g., size, complexity, defects, effort).
• Define Measurement Metrics and Scales
• Decide how the attribute will be quantified.
• Example: LOC (ratio scale), defect severity (ordinal scale).
• Data Collection
• Gather the measurement data using tools, checklists, or automated systems.
• Example: Static analysis tools for code complexity.
• Data Analysis & Interpretation
• Convert raw data into meaningful information.
• Example: Compute defect density = (defects / KLOC).
• Interpret results: higher density → lower quality.
• Validation and Verification
• Check if the measurement is valid (measuring the right property) and reliable (consistent results).
• Reporting and Feedback
• Present results in a way that supports decision-making (e.g., dashboards, reports).
18
• Provide feedback to improve future measurements.
Illustration (Simple Flow)
• Goals → Entities & Attributes → Define Metrics → Collect Data →
Analyze & Interpret → Validate → Report & Use
Why the Measurement Process is Important?
• Ensures measurements are systematic, consistent, and purposeful.
• Prevents wasting time on meaningless or misleading metrics.
• Provides a feedback loop for continuous improvement in software
projects.
19
Scales of Measurement
Definition
• A scale of measurement defines the rules for assigning numbers (or
symbols) to the attributes of entities.
• It determines what mathematical operations and comparisons are
meaningful.
• Essential for ensuring that metrics are interpreted correctly.
20
Types of Measurement Scales
• Nominal Scale
• Numbers (or labels) are used only for classification.
• No order or magnitude implied.
• Examples in software:
• Defect categories (logic error = 1, syntax error = 2, runtime error = 3).
• Programming languages used (1 = Java, 2 = Python, 3 = C++).
• Ordinal Scale
• Values show rank order, but not the size of differences.
• Examples in software:
• Defect severity (High > Medium > Low).
• Customer satisfaction rating (1 = very dissatisfied, … 5 = very satisfied).
• Interval Scale
• Differences between values are meaningful, but ratios are not.
• No “true zero” point.
• Examples in software:
• Project timeline (Week 2, Week 4 → difference of 2 weeks is meaningful).
• Calendar dates of defect detection.
• Ratio Scale
• Has all properties: order, equal intervals, and a true zero.
• All mathematical operations are valid (addition, multiplication, ratios).
• Examples in software:
• LOC (0 means no code).
• Execution time (0 means no time consumed).
• Number of defects found. 21
• Memory usage (0 KB = none).
Why Scales Matter in Software Metrics
• Ensure meaningfulness of comparisons and calculations.
• Prevent misinterpretation (e.g., you cannot say “twice as severe”
with ordinal data).
• Guide proper statistical analysis (e.g., mean, standard deviation only
make sense for interval/ratio scales).
22
Measurement Validation
Definition
• Measurement validation is the process of determining whether a
software metric actually measures what it is intended to measure
and produces reliable, consistent, and useful results.
• It ensures that the metric is not just a number, but a meaningful
indicator of the software attribute.
23
Approaches to Validation
• Theoretical Validation → Check if the metric is grounded in
measurement theory.
• Example: Does the metric use the right scale (ratio, ordinal, etc.)?
• Empirical Validation → Check if the metric correlates with real-world
outcomes.
• Example: Does defect density correlate with user-reported reliability?
• Expert Judgment → Validation through consensus of experienced
practitioners.
24
Why Measurement Validation is Important?
• Prevents misleading conclusions (e.g., big code ≠ better quality).
• Builds confidence in metrics for project planning, estimation, and
quality assurance.
• Ensures meaningfulness, consistency, and trustworthiness of
measurements.
25
Object-Oriented Measurement
Definition
• Object-Oriented Measurement refers to the process of measuring the
attributes, design, and complexity of software systems that follow
the object-oriented paradigm.
• Traditional metrics (like LOC or function points) are not enough for OO
systems because OO emphasizes classes, objects, inheritance,
polymorphism, and encapsulation.
26
Why OO Measurement is Needed
• OO systems are structured differently compared to procedural ones.
• OO introduces new dimensions of complexity, such as:
• Depth of inheritance hierarchies
• Coupling between classes
• Cohesion within a class
• To assess quality, maintainability, and reusability, OO-specific metrics
are required.
27
Benefits of OO Measurement
• Helps in assessing complexity, reusability, and maintainability of OO
systems.
• Provides early indicators of design quality.
• Supports refactoring and improvement in OO design.
28
Subject-Domain-Oriented
Measurement
Definition
• Subject-domain-oriented measurement is a type of software
measurement where metrics are defined with respect to the specific
application domain (business, scientific, engineering, etc.).
• Unlike general-purpose metrics (like LOC or Cyclomatic Complexity),
these metrics are domain-specific and focus on attributes relevant to
the problem domain.
29
Examples of Subject-Domain-Oriented Metrics
• Banking / Financial Software
• Number of transactions per second
• Security breaches detected
• Compliance with financial regulations
• Real-Time Embedded Systems
• Response time (ms)
• CPU utilization (%)
• Deadline miss ratio
• Web Applications / E-commerce
• Page load time (seconds)
• Number of successful user sessions
• Shopping cart abandonment rate
• Machine Learning / AI Systems
• Accuracy (%)
• Precision, Recall, F1-score
• Training time / Model size
30
Why Subject-domain-oriented measurement Important
• Ensures that measurements are meaningful in the real-world context
of the software.
• Helps stakeholders (developers, customers, managers) assess quality
and performance in ways that matter for their domain.
• Bridges the gap between technical measures and
business/operational goals.
31
Comparison with Property-Oriented Measurement
Aspect Property-Oriented Subject-Domain-Oriented
Internal software properties (size, Domain-specific performance and
Focus
complexity) requirements
LOC, Cyclomatic Complexity, Transactions/sec, response time,
Examples
Cohesion, Coupling accuracy, compliance
General software engineering
Usefulness Tailored to specific domain needs
practices
32