CSE 332s: Software Engineering
Software Quality
Prepared by Hala Shaheen
Fundamentals of Software Quality
Software quality means meeting requirements (both explicit and implicit); it is a mix of
many factors, and different projects may emphasize different ones (e.g., reliability for
medical devices, usability for apps).
Technical metrics help software engineers measure, understand, and improve the quality
of software.
There are no absolute measurements, but metrics give a scientific way to judge:
• How good a design is
• How complex code is
• How maintainable or reliable a system might be
McCall’s Software Quality Factors
McCall’s Software Quality Factors
McCall’s Software Quality Factors
Product Operation Product Revision Product Transition
Correctness: The extent to which a Maintainability: Effort required to Portability: Effort required to
program satisfies the specification locate and fix an error in a program. transfer the program from one
and fulfills the customer's objectives. hardware and/or software system
Flexibility: Effort required to modify
environment to another.
Reliability: The extent to which a an operational program.
program can be expected to perform Reusability: The extent to which a
Testability: Effort required to test a
its intended function with required program (or parts) can be reused in
program.
precision other applications.
Efficiency: The amount of Interoperability: Effort required to
computing resources and code couple one system to another.
required by a program. with other systems?
Integrity: The extent to which
access to software or data by
unauthorized persons can be
controlled.
Usability: Effort required to learn,
operate, prepare input for, and
interpret output of a program.
McCall’s Software Quality Factors
McCall’s Software Quality Factors
Suppose the quality factor = Reliability.
McCall says reliability depends on criteria such as:
• Error tolerance
• Consistency
• Accuracy
The criteria are linked to measurable metrics:
Metric (m) Meaning
m1 Number of failures per month
m2 Mean time to repair (MTTR)
m3 Test coverage (%)
McCall’s Software Quality Factors
Suppose the quality factor = Reliability.
: Metric (m) Meaning
m1 Number of failures per month
m2 Mean time to repair (MTTR)
m3 Test coverage (%)
Regression analysis tells us how much each metric matters:
• c1=−0.7 (more failures → lower reliability)
• c2=−0.2 (longer repair → lower reliability)
• c3=+0.5 (more test coverage → better reliability)
Reliability= (−0.7) m1+ (−0.2)m2+ (0.5)m3 This produces a numeric reliability score
Function Point Metrics
FP: Function Points Definition
Function Points (FP) is a software size measurement technique that quantifies the functionality
provided to the user based on requirements, rather than the lines of code.
It is used to estimate project effort, cost, and productivity, independent of the programming language.
Key Aspects of FP:
● Measures what the system does rather than how it is implemented.
● Language-independent, making it useful for cross-platform comparisons.
● Based on user inputs, outputs, inquiries, files, and interfaces.
Formula for Function Point Calculation
FP=Unadjusted Function Points(UFP) × Adjustment Factor (AF)
● Unadjusted Function Points (UFP) = Sum of function types (Inputs, Outputs, Inquiries,
Files, Interfaces).
● AF = Adjusts based on complexity factors (e.g., performance, reusability).
Function Point Analysis (FPA)
Unadjusted Function Points (UFP)
UFP is the raw count before applying any complexity adjustments
Component Type Meaning
Data the user sends into the system (forms,
EI – External Inputs
commands)
EO – External Outputs Outputs sent from the system (reports, messages)
EQ – External Inquiries Input + Immediate Output (simple queries)
ILF – Internal Logical Files Internal data the system stores
EIF – External Interface Files Data the system reads from other systems
Each item is classified as Low / Average / High complexity and assigned a numerical weight.
Function Point Analysis (FPA)
In Function Point Analysis (FPA), system components are classified into five categories based on how
they interact with data and users. These categories help measure the functional size of software by
evaluating how data is processed and exchanged. Here’s what each category represents:
1. External Inputs (EI)
• Definition: Data that is entered into the system from an external source (user, another system, or
device).
• Examples:
→ A user entering data into a web form.
→ A bank transaction entry (e.g., depositing money).
2. External Outputs (EO)
• Definition: Data that is sent out from the system to an external source.
• Examples:
→ Generating a report (e.g., monthly sales report).
→ Sending an email confirmation after a purchase.
→ Exporting data from a system to a file or another application.
Function Point Analysis (FPA)
3. External Inquiries (EQ)
• Definition: A request for information where no data is changed, only retrieved.
• Examples:
→ A user searching for customer details in a CRM.
→ A dashboard displaying real-time data without modifying it.
→ A system fetching order status based on an order ID.
• Purpose: Provides users with read-only access to stored information.
4. Internal Logical Files (ILF)
• Definition: Files that store data within the system for processing and maintenance.
• Examples:
→ A customer database storing user details.
→ An employee payroll system storing salary records.
• Purpose: Stores persistent data that is managed internally.
5. External Interface Files (EIF)
• Definition: Data files that are maintained by another system but accessed by the current system.
• Examples:
→ A system retrieving product data from an external supplier’s database.
• Purpose: Allows the system to read data from external sources without modifying it.
Function Point Analysis (FPA)
Measurement
Low Average High
Parameter
Number of external
3 4 6
inputs (EI)
Number of external
4 5 7
outputs (EO)
Number of external
3 4 6
inquiries (EQ)
Number of internal files
7 10 15
(ILF)
Number of External
5 7 10
Interfaces (EIF)
Complexity Adjustment Factors (CAF)
There are 15 complexity factors (Fi), representing system-wide characteristics:
Examples:
● System performance requirements
● Distributed functions
● Complex data communications
● Complex algorithms
● Reusability
● Installation ease
● Error handling
Each factor is rated from 0–5:
● 0 = no influence
● 5 = strong influence
Total complexity factor: ∑Fi≤70
Function Point Analysis (FPA)
General Formula: FP=Unadjusted Function Points(UFP) × Adjustment Factor (AF)
Based on lecture : AF = 0.65 + 0.01 * CAF ; CAF = ∑ Fi
Source Code Metrics
Source Code Metrics
1. Cyclomatic Complexity: Measures the number of independent paths in code.
Higher complexity = harder to maintain and test.
2. Halstead Metrics: Measure complexity based on:
• Operators (e.g., +, -, if, while)
• Operands (variables, constants)
Halstead Metrics
Based on Halstead, the computer program (code) is a sequence of operators and their
associated operands
Halstead metrics measure software complexity based on the number of operators and
operands in the code.
Symbol Meaning
n₁ Number of distinct operators
n₂ Number of distinct operands
N₁ Total number of operator occurrences
N₂ Total number of operand occurrences
Summary Table of All Halstead Metrics
Metric Formula Meaning
Vocabulary (n) 𝑛 = 𝑛1 + 𝑛2 total unique elements
Length (N) 𝑁 = 𝑁1 + 𝑁2 total tokens
Volume (V) V = N log 2 𝑛 size of implementation (bits)
𝑛1 𝑁2
Difficulty (D) ∙ how hard program is
2 𝑛2
Mental Effort (E) D∙V mental effort to write code
Time (T) 𝐸 Τ18 (sec.) seconds needed
Bugs / Errors 𝑣 Τ3000 expected defects
Sheet 8
Solution
Question 1
A hotel booking system allows guests to interact with the system to
manage their reservations.
The following diagram describes the system's functionalities.
Using the information provided:
a. Identify and classify all: EI, EO, EQ, ILF, and EIF
b. Compute the Unadjusted Function Points (UFP) using
standard IFPUG weights.
c. Assume the sum of complexity factors ΣFi = 40, compute the
FP
Question 1
a. Identify and classify all: EI, EO, EQ, ILF, and EIF
Function Type
Search Rooms EQ
View Booking Status EQ
Make Reservation EI
Cancel Reservation EI
Revenue Report EO
Reservations DB ILF
Payment System EIF
Question 1
b. Compute the Unadjusted Function Points (UFP) using
standard IFPUG weights.
Type Count Weight Total
EI 2 4 8
EO 1 5 5
EQ 2 4 8
ILF 1 10 10
EIF 1 7 7
UFP= 8+5+8+10+7 = 38
Question 1
c. Assume the sum of complexity factors ΣFi = 40, compute the
FP
UFP= 38, ΣFi = 40
AF = 0.65 + 0.01 * CAF = 0.65 + 0.01 * 40 = 1.05
FP = UFP * AF = 38 * 1.05 = 39.9
Question 2
Using Halstead’s method, perform the following
def compute_total(prices, discount):
tasks:
total = 0
a. Identify all distinct operators (n₁) and distinct
for p in prices:
operands (n₂) in the code.
if p > 0:
b. Compute the following Halstead metrics:
total = total + p
• Program Vocabulary (η)
if total > 100:
• Program Length (N)
total = total - discount
• Volume (V)
return total
• Difficulty (D)
• Effort (E)
• Programming Time (T)
• Estimated Bugs (B)
Question 2
Using Halstead’s method, perform the following
def compute_total(prices, discount):
tasks:
total = 0
a. Identify all distinct operators (n₁) and distinct
for p in prices:
operands (n₂) in the code.
if p > 0:
→ n1 = 12, N1= 19 total = total + p
→ n2 = 7 , N2= 18 if total > 100:
total = total - discount
return total
Question 2
b. Computations
Metric Formula Value
Vocabulary (n) 𝑛 = 𝑛1 + 𝑛2 n= 12+7=19
Length (N) 𝑁 = 𝑁1 + 𝑁2 N= 19+18 = 37
Volume (V) V = N log 2 𝑛 V = 37 log 2 19 = 157.2
𝑛1 𝑁2 12 18
Difficulty (D) ∙ 𝐷= 2
∙ 7 = 15.43
2 𝑛2
Mental Effort (E) D∙V E = 157.2 * 15.43 = 2425.6
Time (T) 𝐸 Τ18 (sec.) T = 134.75 sec. = 2.25 min
Bugs / Errors 𝑣 Τ3000 B = 157.2 / 3000 = 0.0524
→ n1 = 12, N1= 19
→ n2 = 7 , N2= 18
QUESTIONS
For further questions or inquiries,
feel free to reach out:
Email: [Link]@[Link]