Software Design – Perfect Notes (Week 5)
1. Purpose of Design Phase
Transforms the SRS (Software Requirements Specification) into a design document
that can be implemented in code.
Main outputs: module structure, control relationships, interfaces, data structures,
and algorithms for each module.
2. What is a Module?
A module contains related functions and associated data structures.
Modules are the building blocks of software design.
3. Design Process: Iterative Nature
Good designs are rarely achieved in one step; they require several iterations and
refinements.
Design is divided into two main stages:
o High-level (Preliminary) Design: Identifies modules, their relationships, and
interfaces (results in program architecture).
o Detailed Design: Specifies data structures and algorithms for each module
(results in module specifications).
4. Characteristics of Good Software Design
Implements all required functionalities correctly.
Easily understandable (improves maintainability and reduces errors).
Efficient in terms of performance and resource use.
Easily modifiable (amenable to change).
5. Improving Understandability
Use consistent, meaningful names for design components.
Decompose the system into well-defined, independent modules (modularity).
Arrange modules in a clear hierarchy (layering).
6. Modularity
Divides a problem into independent modules (divide and conquer principle).
Independent modules are easier to understand, develop, and maintain.
Hierarchical arrangement (layering) helps manage complexity.
7. Cohesion and Coupling
Cohesion: Measures how strongly the elements within a module are related.
o High cohesion = module does one well-defined task.
Coupling: Measures the degree of interdependence between modules.
o Low coupling = modules interact minimally.
Goal: High cohesion, low coupling (functional independence).
Types of Cohesion (from weakest to strongest):
Coincidental: Unrelated tasks grouped together.
Logical: Similar operations grouped (e.g., all input functions).
Temporal: Tasks executed in the same time span (e.g., initialization).
Procedural: Tasks that must be done in a specific order.
Communicational: Tasks operate on the same data.
Sequential: Output of one task is input to the next.
Functional: All elements contribute to a single, well-defined function.
Types of Coupling (from weakest to strongest):
Data Coupling: Modules share only necessary data (parameters).
Stamp Coupling: Modules share composite data structures.
Control Coupling: One module controls the flow of another (e.g., flags).
Common Coupling: Modules share global data.
Content Coupling: One module directly modifies or relies on the internal workings
of another.
8. Advantages of Functional Independence
Easier to understand and maintain.
Reduces error propagation between modules.
Facilitates module reuse in other programs.
9. Measuring Cohesion and Coupling
No precise quantitative measures, but classification helps estimate quality.
Aim for modules with high cohesion and low coupling.
10. Hierarchical Design and Module Structure
Control Hierarchy: Tree-like structure showing which modules control others.
Fan-out: Number of modules directly controlled by a module (should be low).
Fan-in: Number of modules that call a given module (high fan-in is good for reuse).
Layering: Modules at one layer only call modules in the layer below.
11. Abstraction
Lower-level modules handle detailed tasks; upper-level modules handle
management.
Layered design: lower modules do not call higher modules.
12. Design Approaches
Function-Oriented Design:
o System is seen as a set of functions.
o Functions are refined into sub-functions (top-down decomposition).
o State is centralized and accessible to all functions.
Object-Oriented Design (OOD):
o System is seen as a collection of objects (entities with data and behavior).
o State is decentralized; each object manages its own data.
o Objects communicate via message passing.
o Classes group similar objects; inheritance allows sharing features.
Key Differences:
Function-oriented: focus on functions (verbs), centralized data.
Object-oriented: focus on objects/entities (nouns), distributed data.
OOD is often used for overall system structure, with function-oriented techniques for
internal methods.
13. Summary
Design phase transforms requirements into a structured, implementable plan.
Good design = high cohesion, low coupling, clear hierarchy, and modularity.
Both function-oriented and object-oriented approaches are valuable and often
complementary.