CACS253 Software Engineering

Software EngineeringUnit 618 min read

Software Quality Management: Metrics, Models, Testing & Assurance

Unit 6 of Software Engineering covers quality metrics (ISO/IEC 25010), cost estimation models (COCOMO), testing techniques (black-box vs. white-box), risk management, and quality assurance frameworks (CMM/CMMI). Learn how to measure, predict, and enforce quality in real-world projects like eSewa’s transaction systems o

Core Concepts: What is Software Quality?

Software quality is the degree to which a software product satisfies stated and implied needs (ISO/IEC 25010). It is not just about "bug-free" code but about meeting functional (what it does) and non-functional (how well it does it) requirements. Quality is measurable, predictable, and enforceable through systematic processes.

Quality Characteristics (ISO/IEC 25010)

Quality is broken into 8 high-level characteristics, each with sub-characteristics. Visualize them as layers in a quality pyramid:

Functional CompletenessFunctional CorrectnessFunctional AppropriatenessFunctional SuitabilityTime BehaviorResource UtilizationCapacityPerformance EfficiencyCoexistenceInteroperabilityCompatibilityAppropriateness RecognizabilityLearnabilityOperabilityUser Error ProtectionAccessibilityUsabilityFault ToleranceRecoverabilityAvailabilityMaturityReliabilityConfidentialityIntegrityNon-repudiationAccountabilityAuthenticitySecuritySoftware Quality (ISO/IEC 25010)
Hierarchical breakdown of ISO/IEC 25010 quality characteristics (simplified for clarity)

Example: For eSewa, performance efficiency (fast transaction processing) and security (confidentiality of user data) are critical. For Pathao, usability (easy driver-passenger matching) and reliability (availability during peak hours) matter most.


1. Software Quality Metrics

Metrics quantify quality attributes. Common metrics include:

023.7547.571.2595Functional Suitability85Performance Efficiency78Usability92Reliability88Security95Maintainability72Portability80
Example metric scores (0-100) for a hypothetical software project
Category Metric Example
Size Metrics Lines of Code (LOC) A module with 500 LOC may need more testing than 100 LOC.
Complexity Metrics Cyclomatic Complexity A function with 10 decision points (if, for) has higher complexity.
Defect Metrics Defect Density 5 defects per 1,000 LOC in a module.
Performance Metrics Response Time Daraz’s checkout page loads in ≤2s (90th percentile).
Reliability Metrics Mean Time Between Failures (MTBF) Ncell’s app crashes once every 100 logins.

Worked Example: Suppose Khalti wants to measure the quality of its payment gateway module. They track:

  • Defect Density: 3 defects per 1,000 LOC in the payment module (acceptable if industry average is 5).
  • Response Time: 95% of transactions complete in <1.5s (meets SLA).
  • Security Vulnerabilities: 0 critical CVEs in the last audit.


2. Software Cost Estimation Models

Estimating cost and effort is critical for project planning. The COCOMO (Constructive Cost Model) is the most widely used.

COCOMO Model Types

Model Description When to Use
Basic COCOMO Estimates effort based on LOC (Lines of Code). Early project phases, rough estimates.
Intermediate COCOMO Adds 15 cost drivers (e.g., product attributes, hardware constraints). Medium-sized projects (10K–300K LOC).
Advanced COCOMO Uses 63 cost drivers and phase-wise estimation. Large, complex projects (e.g., banking systems).

COCOMO Formula (Basic Model)

Effort (in person-months) = where KLOC = Thousands of Lines of Code.

08162431Effort (KDSI)16 bitsSize (KLOC)8 bitsCost DriverMultipliers8 bits
COCOMO Basic Model input structure (simplified)

Example: Estimate effort for a banking app with 50K LOC: Interpretation: The team needs ~11.5 person-years (138/12) to develop the app.



COCOMO Cost Drivers (Intermediate Model)

Category Factors
Product Attributes Required reliability, database size, product complexity.
Hardware Attributes Execution time constraints, main memory size.
Personnel Attributes Analyst capability, programmer capability, programmer experience.
Project Attributes Use of modern programming practices, use of software tools.

Real-World Tie-In: Nepal Rastra Bank (NRB) uses COCOMO to estimate the cost of developing core banking systems. For a module with:

  • High reliability (cost driver = 1.15)
  • Large database (cost driver = 1.05)
  • Experienced team (cost driver = 0.90) The adjusted effort becomes:

3. Software Testing Techniques

Testing ensures quality by identifying defects. Two primary approaches:

A. Black-Box Testing

Tests functionality without knowing internal code.

  • Input: Requirements/SRS.
  • Output: Test cases based on equivalence partitioning or boundary value analysis.
  • Example: Testing Daraz’s checkout flow without seeing the code.
Technique Description Example
Equivalence Partitioning Divide inputs into classes (valid/invalid). For age input: 0, 13, 18, 20, 100 → test 13 (invalid), 18 (valid).
Boundary Value Analysis Test boundary conditions (min, max, just above/below). For a loan amount: test 1,000, 500,000, 500,001 (if max is 500K).
Decision Table Testing Test combinations of boolean conditions. "If (user is premium AND order > 10K) THEN free shipping."

Worked Example: NTC’s billing system requires testing for:

  • Invalid mobile numbers (e.g., "9800000000" vs. "9812345678").
  • Boundary values (e.g., 0 minutes, 1 minute, 24 hours for prepaid data).

B. White-Box Testing

Tests internal logic (requires code access).

  • Input: Source code.
  • Output: Test cases based on code coverage (statement, branch, path).
  • Example: Checking if Khalti’s transaction log correctly records every payment.
Technique Description Example
Statement Coverage Every line executed at least once. In a for loop, ensure all iterations run.
Branch Coverage Every if-else condition tested (true/false). Test "success" and "failure" paths in a login function.
Path Coverage All possible code paths tested. In a nested if, test all combinations (e.g., if (A && B) { ... }).

Worked Example: Pathao’s driver assignment algorithm has a critical path:

if (driver_available AND distance < 5km AND rating > 4.5):
    assign_ride()
else:
    search_next_driver()

Test cases:

  1. driver_available=True, distance=3km, rating=4.6 → Should assign.
  2. driver_available=False, distance=2km, rating=5.0 → Should search next.


4. Risk Management in Software Engineering

Risk is any event that could negatively impact a project. The risk management process is cyclic:

Risk IdentificationRisk AnalysisRisk PrioritizationRisk MitigationRisk Monitoring
Cyclic risk management process (arrows show progression)

Steps in Risk Management

  1. Risk Identification

    • Brainstorming, checklists, expert judgment.
    • Example: "Database migration might fail during peak hours."
  2. Risk Analysis

    • Qualitative: High/Medium/Low probability + impact.
    • Quantitative: Probability × Impact = Risk Score.
    • Example:
      Risk Probability Impact Score (P×I)
      Server downtime High (0.8) High (0.9) 0.72
      Third-party API failure Medium (0.5) Medium (0.6) 0.30
  3. Risk Prioritization

    • Focus on high-score risks first.
  4. Risk Mitigation

    • Avoid: Don’t use a risky technology (e.g., avoid untested libraries).
    • Transfer: Outsource to experts (e.g., hire a DevOps team for cloud setup).
    • Reduce: Add redundancy (e.g., backup databases for Ncell’s billing system).
    • Accept: Low-impact risks (e.g., minor UI delays).
  5. Risk Monitoring

    • Track risks in tools like Jira or MS Project.

Real-World Example: Nepal Stock Exchange (NEPSE) manages risks in its trading platform:

  • Risk: "Cyberattack during market hours."
  • Mitigation:
    • Redundant servers (failover).
    • Penetration testing (quarterly).
    • Backup trading system (manual override).

5. Quality Assurance (QA) vs. Quality Control (QC)

Aspect Quality Assurance (QA) Quality Control (QC)
Focus Preventing defects (process-oriented). Finding defects (product-oriented).
Activities Reviews, audits, training, standards (e.g., ISO). Testing, inspections, defect tracking.
Example eSewa trains developers on secure coding. eSewa runs automated tests before deployment.

Capability Maturity Model Integration (CMMI)

A 5-level maturity model for process improvement:

Level Name Description When to Use
1 Initial Ad-hoc processes, no repeatability. Startups, small projects.
2 Managed Basic project management (planning, tracking). Medium-sized teams.
3 Defined Standardized processes (e.g., templates for requirements, design). Organizations scaling up (e.g., banks).
4 Quantitatively Managed Metrics-driven (e.g., defect rates, schedule variance). Critical systems (e.g., NTC’s core network).
5 Optimizing Continuous improvement (e.g., Agile, DevOps). Global enterprises (e.g., Google).

When to Use Staged Representation?

  • Use staged if:
    • Organization is new to CMMI.
    • Budget is limited (focus on one area at a time).
  • Avoid staged if:
    • Project is large and complex (e.g., national ID system like Citizen’s Charter).


6. Good Programming Practices for Quality

Follow these to reduce defects and improve maintainability:

A. Code-Level Practices

  • Modularity: Break code into small, reusable modules (e.g., UserAuth, PaymentGateway).
  • DRY (Don’t Repeat Yourself): Avoid duplicate code.
  • Meaningful Naming: calculateTax() > func1().
  • Comments & Documentation: Explain why, not just what.
  • Error Handling: Use exceptions (e.g., try-catch in Java/Python).

B. Design-Level Practices

  • Loose Coupling: Modules should depend on abstractions, not each other.
    • Bad: OrderService directly calls PaymentService.
    • Good: OrderService uses IPaymentGateway interface.
  • High Cohesion: Each module should do one thing well.
    • Bad: UserModule handles login, payments, and notifications.
    • Good: Separate AuthModule, PaymentModule, NotificationModule.

Example: Daraz’s order processing system:

  • High Cohesion: InventoryModule only manages stock.
  • Low Coupling: OrderModule communicates via API, not direct function calls.

graph LR
  A["High Cohesion Example"] -->|"InventoryModule"| B((Circle))
  C["Low Coupling Example"] -->|"OrderModule"| D((Circle))
  B -->|"API"| D
  E["Spaghetti Code"] -->|"Tight Coupling"| F((Circle))
  F -->|"Direct Calls"| G((Circle))
A side-by-side comparison: tightly coupled modules (spaghetti code) vs. loosely coupled (independent boxes). (Image: Евгений Мирошниченко, CC0, via Wikimedia Commons)

7. Computer-Aided Software Engineering (CASE) Tools

CASE tools automate parts of software development to improve quality.

Types of CASE Tools

Type Description Examples
Upper CASE Supports analysis & design (e.g., UML diagrams, requirements management). Rational Rose, Lucidchart.
Lower CASE Supports coding & testing (e.g., code generators, debuggers). Visual Studio, Eclipse.
Integrated CASE Combines upper + lower CASE (end-to-end support). IBM Rational, Enterprise Architect.

Benefits of CASE Tools

  • Reduces errors (e.g., automated code generation).
  • Improves documentation (e.g., UML diagrams auto-updated).
  • Saves time (e.g., test case generation).
  • Enforces standards (e.g., coding guidelines via IDE plugins).

Real-World Example: Ncell uses Jira + Confluence (CASE-like tools) for:

  • Requirements tracking (Confluence).
  • Automated testing (Jira + Xray for test management).
  • Code reviews (GitHub/GitLab integration).


In the Real World

  1. eSewa’s Transaction System

    • Quality Metric Used: Security (confidentiality, integrity).
    • How: Every transaction is logged with timestamps and encrypted. White-box testing checks for SQL injection vulnerabilities.
    • Risk Mitigation: Redundant servers in case of downtime.
  2. Daraz’s Order Fulfillment

    • Quality Metric Used: Performance (response time ≤2s for 95% of orders).
    • Testing Technique: Load testing (simulate 10,000 concurrent users).
    • COCOMO Application: Estimated effort for the checkout module was 80 person-months (based on 30K LOC).
  3. NTC’s Network Management

    • Quality Model: CMMI Level 4 (quantitative metrics for network uptime).
    • Risk Management: Monthly penetration tests to find vulnerabilities before hackers do.
    • Good Practice: Modular design (separate modules for billing, authentication, and routing).
  4. Nepal Rastra Bank’s Core Banking System

    • Quality Assurance: Formal code reviews before deployment.
    • Testing: Black-box testing for user flows (e.g., loan approval).
    • CASE Tool: IBM Rational for UML modeling and requirements traceability.

Exam Tip

  1. COCOMO Questions:

    • Always show the formula and calculate step-by-step.
    • For part (b), compare black-box vs. white-box using a table (as above).
    • Example Answer Structure:

      "The COCOMO model estimates effort as . For the intermediate model, 15 cost drivers adjust this estimate. For a banking app with 50K LOC and high reliability (cost driver = 1.15), the adjusted effort is calculated as follows: [steps]."

  2. Risk Management:

    • Draw the state diagram (as above) and label all steps.
    • Real-world tie-in: Always relate to Nepalese examples (e.g., NTC, NRB, eSewa).
  3. Testing Techniques:

    • Black-box: Give 2 test cases (equivalence + boundary).
    • White-box: Show code coverage (e.g., "branch coverage achieved 90%").
    • Comparison Table: Use a 2-column table for black-box vs. white-box.
  4. CMMI:

    • Define all 5 levels in a table (as above).
    • Staged vs. Continuous: Explain when to use each (budget vs. complexity).
  5. Good Practices:

    • Modularity: Show a diagram of loosely coupled modules.
    • Cohesion/Coupling: Use real examples (e.g., Daraz’s modules).
  6. CASE Tools:

    • List 3 types (upper, lower, integrated) with examples.
    • Benefits: Mention automation and standardization.

Final Pro Tip:

  • Memorize the ISO 25010 quality characteristics (use the mindmap above).
  • Practice COCOMO calculations with different KLOC values.
  • Relate every concept to Nepalese tech companies (e.g., NTC, NRB, eSewa). Examiners love local examples!

Based on the TU BCA syllabus for Software Engineering (CACS253), unit 6.

Discussion

Loading…