Unit 3: Software Design



Software Design

Software Design is the process of converting requirements (SRS) into a blueprint that guides developers in coding the software.

In simple words: Design = Planning how the software will be built

Objectives of Software Design

  • Convert requirements into workable solution
  • Reduce complexity
  • Improve software quality
  • Make coding and testing easier
  • Support maintenance and future changes

Design Levels

  1. High-Level Design (Architectural Design)
  2. Low-Level Design (Detailed Design)

Architectural Design (High-Level Design)

Architectural Design defines the overall structure of the software system, including major components and their interactions.

Key Elements

  • Subsystems / modules
  • Data flow between modules
  • Control relationships
  • External interfaces

Common Architectural Styles

StyleDescription
LayeredSystem divided into layers
Client-ServerClient requests, server responds
Pipe & FilterData processed in stages
MVCModel-View-Controller pattern

Advantages

  • Clear system structure
  • Easy to understand
  • Supports scalability
  • Improves maintainability

Low-Level Design (LLD)

Low-Level Design focuses on internal working of modules and detailed logic.

Modularization

Modularization is the process of dividing a system into smaller, manageable modules.

Each module performs a specific function

Advantages of Modularization

  • Easy debugging
  • Parallel development
  • Reusability
  • Better maintenance

Characteristics of a Good Module

  • High cohesion
  • Low coupling
  • Simple interface

Design Structure Charts (DSC)

A Design Structure Chart is a hierarchical diagram showing modules and their relationships.

Elements of Structure Chart

ElementDescription
RectangleModule
ArrowData/control flow
HierarchyParent-child modules

Importance

  • Visual representation of design
  • Helps in coding and testing
  • Shows module dependency

Pseudo Codes

Pseudocode is an informal, English-like description of program logic.

Features

  • Easy to understand
  • Not language-specific
  • Helps in algorithm design

Example

START Read A, B SUM = A + B Print SUM END

Flow Charts

A Flowchart is a graphical representation of program logic using standard symbols.

Common Flowchart Symbols

SymbolMeaning
OvalStart / End
RectangleProcess
DiamondDecision
ArrowFlow direction

Advantages

  • Easy visualization
  • Helpful in debugging
  • Improves understanding

Coupling

Coupling refers to the degree of dependency between modules.

Lower coupling is better

Types of Coupling (From Best to Worst)

TypeDescription
Data CouplingData passed as parameters
Stamp CouplingStructure passed
Control CouplingControl flags passed
Common CouplingShared global data
Content CouplingOne module modifies another

Cohesion

Cohesion refers to how closely related the elements inside a module are.

Higher cohesion is better

Types of Cohesion (From Worst to Best)

TypeDescription
CoincidentalUnrelated tasks
LogicalSimilar logic
TemporalTasks related to time
ProceduralSequence based
CommunicationalSame data used
SequentialOutput of one is input to another
FunctionalSingle, well-defined task

Coupling vs Cohesion (Very Important)

BasisCouplingCohesion
MeaningInter-module dependencyIntra-module relation
IdealLowHigh
ImpactAffects flexibilityAffects clarity
QualityLow coupling → better designHigh cohesion → better design

Quick Revision Table

TopicKey Point
Software DesignBlueprint of software
Architectural DesignHigh-level structure
ModularizationDivide into modules
Structure ChartModule hierarchy
PseudocodeLogic description
FlowchartGraphical logic
CouplingModule dependency
CohesionModule internal strength

Important Exam Questions

  • Explain software design and its objectives
  • What is architectural design?
  • Explain modularization
  • Difference between coupling and cohesion
  • Types of cohesion and coupling

Conclusion

Software design transforms requirements into a structured solution. Good design focuses on modularization, low coupling, and high cohesion, resulting in high-quality, maintainable software.

Design Strategies in Software Engineering

Design Strategies are approaches or methods used to plan and structure software design so that the system becomes easy to understand, develop, test, and maintain.

Function-Oriented Design (FOD)

Function-Oriented Design focuses on what functions the system should perform. The system is divided into functions and sub-functions.

Emphasis is on processes, not data.

Key Features

  • Based on functions
  • Uses top-down approach
  • Data flows between functions
  • Common tools: DFD and Structure Charts

Steps in Function-Oriented Design

  • Identify main function
  • Divide into sub-functions
  • Create DFD
  • Develop structure chart

Advantages

  • Easy to understand
  • Suitable for small systems
  • Simple design approach

Disadvantages

  • Difficult to modify
  • Poor data security
  • Not suitable for large systems

Example

Payroll System
→ Calculate salary
→ Generate payslip
→ Deduct tax

Object-Oriented Design (OOD)

Object-Oriented Design organizes the system around objects, which contain data (attributes) and functions (methods).

Emphasis is on data and behavior together.

Key Features

  • Based on objects and classes
  • Uses encapsulation, inheritance, polymorphism
  • More flexible and reusable
  • Uses UML diagrams

Advantages

  • High reusability
  • Easy maintenance
  • Better data security
  • Suitable for large systems

Disadvantages

  • Complex design
  • Requires skilled developers
  • Higher initial cost

Example

Student Object

  • Data: Name, Roll No
  • Methods: Register(), PayFees()

Top-Down Design

Top-Down Design starts from the main system and gradually breaks it down into smaller modules.

 From general to detailed

Steps

  • Identify main problem
  • Divide into sub-modules
  • Continue until simple modules

Advantages

  • Clear system structure
  • Easy planning
  • Better control

Disadvantages

  • Lower-level issues found late
  • Requires good initial understanding

Bottom-Up Design

Bottom-Up Design starts from small modules and integrates them to form a complete system.

Steps

  • Design basic modules
  • Combine modules
  • Form higher-level system

Advantages

  • Reusable components
  • Easy testing of modules
  • Suitable for object-oriented systems

Disadvantages

  • Difficult system planning
  • Architecture may not be clear initially

Comparison Tables (Very Important for Exams)

Function-Oriented vs Object-Oriented Design

BasisFunction-OrientedObject-Oriented
FocusFunctionsObjects
Data HandlingSeparate from functionsEncapsulated
ReusabilityLowHigh
MaintenanceDifficultEasy
Suitable forSmall systemsLarge systems

Top-Down vs Bottom-Up Design

BasisTop-DownBottom-Up
ApproachGeneral to detailDetail to general
Start PointMain systemSmall modules
PlanningEasyDifficult
TestingLateEarly
ReusabilityLowHigh

Quick Revision Points

  • Function-Oriented Design → process-based
  • Object-Oriented Design → data + behavior
  • Top-Down → divide system
  • Bottom-Up → build system
  • Good design → low coupling, high cohesion

Important Exam Questions

  • Explain Function-Oriented Design
  • Compare Function-Oriented and Object-Oriented Design
  • Explain Top-Down and Bottom-Up Design
  • Advantages of Object-Oriented Design

Conclusion

Design strategies play a crucial role in developing quality software. Function-oriented design is simple and suitable for small projects, while object-oriented design is flexible and ideal for complex systems. Top-down and bottom-up approaches help structure the design process effectively.

Software Measurement and Metrics

Software Measurement is the process of assigning numbers or values to software attributes such as size, complexity, cost, and quality.

In simple words: Software Measurement = Measuring software to estimate effort, cost, and quality

What are Software Metrics?

Software Metrics are quantitative measures used to evaluate, predict, and improve software development and maintenance.

Objectives of Software Metrics

  • Estimate cost and effort
  • Measure software size and complexity
  • Improve quality
  • Control project progress

Size-Oriented Measures

Size-oriented measures evaluate software based on its size, usually calculated using:

  • Lines of Code (LOC)
  • Operators and operands
  • Functional features

Examples of Size-Oriented Metrics

  • Productivity = LOC / Person-month
  • Quality = Errors / KLOC
  • Cost = ₹ / LOC

Halstead’s Software Science

Halstead’s Software Science is a size-oriented metric that measures software complexity based on operators and operands used in the program.

Basic Terms in Halstead Metrics

SymbolMeaning
n₁Number of distinct operators
n₂Number of distinct operands
N₁Total operators
N₂Total operands

Important Halstead Formulas 

1. Program Vocabulary

n=n1+n2​

2. Program Length

N=N1+N2​

3. Volume

V=N×log2(n)

4. Difficulty

D=n12×N2n2​​

5. Effort

E=D×V

Advantages of Halstead Metrics

  • Language independent
  • Simple mathematical model
  • Useful for effort estimation

Limitations

  • Ignores program structure
  • Not suitable for very large systems

Function Point (FP) Based Measures

Function Point Analysis measures software size based on functionality provided to the user, not on code length.

FP focuses on “what the software does”

Main Components of Function Points

ComponentDescription
External Inputs (EI)User inputs
External Outputs (EO)Reports, results
External Inquiries (EQ)Online queries
Internal Logical Files (ILF)Internal data
External Interface Files (EIF)External data

Steps in Function Point Calculation

Step 1: Count Function Types

Assign complexity weights (Low, Average, High).

Step 2: Calculate Unadjusted Function Points (UFP)

Step 3: Calculate Value Adjustment Factor (VAF)

VAF=0.65+(0.01×Total GSC)

Step 4: Final Function Points

FP=UFP×VAF

Advantages of FP Metrics

  • Independent of programming language
  • Suitable for early estimation
  • Better than LOC for large systems

Disadvantages

  • Complex calculation
  • Requires expert judgment

Cyclomatic Complexity Measure

Cyclomatic Complexity measures the logical complexity of a program by counting independent paths through the code.

Proposed by McCabe

Why Cyclomatic Complexity is Important

  • Measures code complexity
  • Helps in test case design
  • Indicates maintenance difficulty

Control Flow Graph (CFG)

A Control Flow Graph represents flow of control in a program.

Components of CFG

ComponentMeaning
NodeStatement or block
EdgeFlow of control
RegionArea bounded by edges

Formulas for Cyclomatic Complexity (Exam Favourite)

Method 1: Using Edges and Nodes

V(G)=EN+2

Where:
E = Number of edges
N = Number of nodes

Method 2: Using Predicate Nodes

V(G)=P+1

Where: P = Number of decision (if/while) nodes

Interpretation of Cyclomatic Complexity

ValueMeaning
1–10Simple, low risk
11–20Moderate complexity
21–50High complexity
>50Very complex, risky

Comparison Table (Exam-Oriented)

MetricFocus
HalsteadOperators & operands
Function PointUser functionality
Cyclomatic ComplexityControl flow complexity

Important Exam Questions

  • Explain Halstead’s Software Science with formulas
  • What is Function Point Analysis? Explain steps
  • Define Cyclomatic Complexity
  • Explain Control Flow Graph
  • Compare LOC and FP metrics

Conclusion

Software measurement and metrics help in estimating effort, controlling complexity, improving quality, and managing software projects effectively. Metrics like Halstead, Function Points, and Cyclomatic Complexity are widely used in software engineering.