Software design transforms requirements into a blueprint for construction. It’s where architecture, modules, interfaces, and data structures are defined. The golden rule: high cohesion, low coupling.
Coupling (Inter-module dependency)
Measures how much one module depends on another. Lower is better.
| Type (worst → best) | Description |
|---|---|
| Content coupling | One module directly modifies data inside another (worst). |
| Common coupling | Modules share global data. |
| Control coupling | One module passes control flags to another. |
| Stamp coupling | Modules pass data structures but only use parts of them. |
| Data coupling | Modules pass only the necessary data (best). |
Cohesion (Intra-module focus)
Measures how related the elements within a module are. Higher is better.
| Type (worst → best) | Description |
|---|---|
| Coincidental | Random unrelated functions grouped arbitrarily. |
| Logical | Functions grouped by category (e.g., “all I/O functions”). |
| Temporal | Functions grouped because they happen at the same time. |
| Procedural | Functions grouped by sequence of operations. |
| Communicational | Functions that operate on the same data. |
| Sequential | Output of one function is input to the next. |
| Functional | All functions contribute to a single well-defined task (best). |
Design Approaches
| Approach | How it works | Best for |
|---|---|---|
| Top-down | Start with high-level system, decompose into sub-modules. | Well-understood problems, structured programming. |
| Bottom-up | Build primitive components first, compose into larger systems. | When low-level building blocks are known first. |
| Function-oriented | Decompose by function (input → process → output). | Traditional structured design. |
| Object-oriented | Decompose by objects (data + methods). | Complex systems with evolving requirements. |
Design Patterns (Gang of Four — 23 patterns)
Three categories:
- Creational — object creation mechanisms (Factory, Singleton, Builder).
- Structural — object composition (Adapter, Decorator, Proxy, Facade).
- Behavioral — object interaction (Observer, Strategy, Command, Template Method).
Architectural Styles
| Style | Description | Example |
|---|---|---|
| Layered | Each layer serves the one above it | OSI model, web apps (presentation → business → data) |
| MVC | Model-View-Controller separation | Web frameworks (Rails, Spring MVC, Django) |
| Microservices | Independent services communicating via APIs | Netflix, Amazon |
| Client-Server | Clients request, servers respond | Most web applications |
| Event-driven | Components react to events | GUI apps, real-time systems |
UI Design Principles (Nielsen’s 10 Usability Heuristics)
- Visibility of system status
- Match between system and the real world
- User control and freedom
- Consistency and standards
- Error prevention
- Recognition rather than recall
- Flexibility and efficiency of use
- Aesthetic and minimalist design
- Help users recognize, diagnose, and recover from errors
- Help and documentation
Q: Explain “high cohesion, low coupling” with an example.
A: A well-designed calculator module has high cohesion (all functions are calculation-related) and low coupling (it receives two numbers and returns a result — no shared global state). A poorly designed module might handle calculations and file I/O and UI rendering (low cohesion) while depending on global variables (high coupling).
Q: What is the difference between a design pattern and an architectural style?
A: A design pattern solves a local problem (e.g., “how to create objects” — Factory pattern). An architectural style defines the global structure (e.g., “how to organize the whole application” — MVC, microservices).
Q: When would you use a microservices architecture?
A: When the system has independently deployable components with different scaling needs, release cycles, or technology requirements. Not suitable for simple CRUD apps — the operational complexity isn’t justified.
Q: What is the MVC pattern?
A: Model (data + business logic), View (UI rendering), Controller (handles user input, updates Model and View). Separates concerns so each can be modified independently.
Premium Content
Unlock Software Design Concepts and all premium lessons with a subscription.
From ₹199.99/year — See plans