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
- High-Level Design (Architectural Design)
- 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
| Style | Description |
|---|---|
| Layered | System divided into layers |
| Client-Server | Client requests, server responds |
| Pipe & Filter | Data processed in stages |
| MVC | Model-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
| Element | Description |
|---|---|
| Rectangle | Module |
| Arrow | Data/control flow |
| Hierarchy | Parent-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
Flow Charts
A Flowchart is a graphical representation of program logic using standard symbols.
Common Flowchart Symbols
| Symbol | Meaning |
|---|---|
| Oval | Start / End |
| Rectangle | Process |
| Diamond | Decision |
| Arrow | Flow 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)
| Type | Description |
|---|---|
| Data Coupling | Data passed as parameters |
| Stamp Coupling | Structure passed |
| Control Coupling | Control flags passed |
| Common Coupling | Shared global data |
| Content Coupling | One 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)
| Type | Description |
|---|---|
| Coincidental | Unrelated tasks |
| Logical | Similar logic |
| Temporal | Tasks related to time |
| Procedural | Sequence based |
| Communicational | Same data used |
| Sequential | Output of one is input to another |
| Functional | Single, well-defined task |
Coupling vs Cohesion (Very Important)
| Basis | Coupling | Cohesion |
|---|---|---|
| Meaning | Inter-module dependency | Intra-module relation |
| Ideal | Low | High |
| Impact | Affects flexibility | Affects clarity |
| Quality | Low coupling → better design | High cohesion → better design |
Quick Revision Table
| Topic | Key Point |
|---|---|
| Software Design | Blueprint of software |
| Architectural Design | High-level structure |
| Modularization | Divide into modules |
| Structure Chart | Module hierarchy |
| Pseudocode | Logic description |
| Flowchart | Graphical logic |
| Coupling | Module dependency |
| Cohesion | Module 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
| Basis | Function-Oriented | Object-Oriented |
|---|---|---|
| Focus | Functions | Objects |
| Data Handling | Separate from functions | Encapsulated |
| Reusability | Low | High |
| Maintenance | Difficult | Easy |
| Suitable for | Small systems | Large systems |
Top-Down vs Bottom-Up Design
| Basis | Top-Down | Bottom-Up |
|---|---|---|
| Approach | General to detail | Detail to general |
| Start Point | Main system | Small modules |
| Planning | Easy | Difficult |
| Testing | Late | Early |
| Reusability | Low | High |
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
| Symbol | Meaning |
|---|---|
| n₁ | Number of distinct operators |
| n₂ | Number of distinct operands |
| N₁ | Total operators |
| N₂ | Total operands |
Important Halstead Formulas
1. Program Vocabulary
2. Program Length
3. Volume
4. Difficulty
5. Effort
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
| Component | Description |
|---|---|
| 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)
Step 4: Final Function Points
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
| Component | Meaning |
|---|---|
| Node | Statement or block |
| Edge | Flow of control |
| Region | Area bounded by edges |
Formulas for Cyclomatic Complexity (Exam Favourite)
Method 1: Using Edges and Nodes
Where:
E = Number of edges
N = Number of nodes
Method 2: Using Predicate Nodes
Where: P = Number of decision (if/while) nodes
Interpretation of Cyclomatic Complexity
| Value | Meaning |
|---|---|
| 1–10 | Simple, low risk |
| 11–20 | Moderate complexity |
| 21–50 | High complexity |
| >50 | Very complex, risky |
Comparison Table (Exam-Oriented)
| Metric | Focus |
|---|---|
| Halstead | Operators & operands |
| Function Point | User functionality |
| Cyclomatic Complexity | Control 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.