SE Notes
Designing system architecture and components based on requirements.
The system design phase transforms the "what" defined during requirement analysis into the "how" of implementation. It is the architectural blueprint phase where engineers decide how the system will be structured, which technologies will be used, how components will communicate, and how data will flow through the system. Just as an architect's blueprints guide construction workers to build exactly the right building, system design documents guide developers to build exactly the right software. Poor design leads to systems that are difficult to maintain, impossible to scale, and expensive to modify—regardless of how well the code is written.
High-Level Design vs. Low-Level Design
System design operates at two levels of abstraction:
High-Level Design (HLD) defines the system's overall architecture—the major components, their responsibilities, and how they interact. It answers questions like: Is this a monolithic or microservices system? How many tiers does the architecture have? Which external systems does it integrate with? What are the major data stores?
Low-Level Design (LLD) specifies the internal details of each component identified in the HLD. It defines class structures, method signatures, algorithms, database schemas, and detailed interface specifications. LLD is detailed enough that a developer can write code directly from it without further clarification.
Design Activities
Architectural Design establishes the system's fundamental structure. Common architectural patterns include:
- Layered Architecture: Presentation → Business Logic → Data Access → Database. Each layer communicates only with adjacent layers, creating clean separation of concerns.
- Microservices: Independent services communicating via APIs, each owning its data and deployable separately.
- Event-Driven: Components communicate through asynchronous events, enabling loose coupling and scalability.
- Client-Server: Centralized server providing services to multiple clients.
Database Design defines how data is organized, stored, and accessed:
| Customer | ──1:N── | Order | ──1:N── | OrderItem |
|---|---|---|---|---|
| customer_id | order_id | item_id | ||
| name | customer_id | order_id | ||
| order_date | product_id | |||
| address | total_amount | quantity |
Decisions include relational vs. NoSQL databases, normalization level, indexing strategy, partitioning scheme, and replication topology.
Interface Design specifies how components communicate with each other and with external systems. This includes API contracts (REST endpoints, request/response formats), message formats for asynchronous communication, file formats for batch interfaces, and user interface specifications.
Module Decomposition breaks the system into manageable units of work. Each module should have high cohesion (related functions grouped together) and low coupling (minimal dependencies between modules). This decomposition directly influences how development work is distributed among team members.
Real-World Example: Food Delivery Application
Based on requirements for a food delivery app (like Uber Eats), the system design phase produces:
Architecture Decision: Microservices architecture selected for independent scalability. Services include:
- User Service (authentication, profiles)
- Restaurant Service (menus, availability, ratings)
- Order Service (order creation, status tracking)
- Delivery Service (driver matching, route optimization)
- Payment Service (payment processing, refunds)
- Notification Service (push notifications, SMS, email)
Communication Design: Synchronous REST APIs for user-facing operations (placing orders, checking status). Asynchronous message queues (Kafka) for internal events (order placed → notify restaurant, delivery assigned → notify customer).
Data Store Decisions: PostgreSQL for structured transactional data (orders, users). Redis for real-time driver locations and session caching. Elasticsearch for restaurant search with geographic and keyword queries.
Scalability Design: Each service auto-scales independently based on load. The delivery service needs more instances during lunch/dinner peaks. The payment service needs redundancy for reliability.
Design Principles
Separation of Concerns: Each component handles one aspect of the system's functionality. The user interface does not contain business logic. The business logic does not know about database specifics.
Information Hiding: Components expose only what other components need to know. Internal implementation details are hidden behind well-defined interfaces, allowing independent modification.
Design for Change: Anticipate which aspects of the system are likely to change and isolate them behind abstractions. Database technology might change. Payment providers might change. UI frameworks might change. Good design minimizes the impact of such changes.
Design for Failure: Assume that any component can fail at any time. Design retry mechanisms, circuit breakers, fallback behaviors, and graceful degradation. In the food delivery example, if the notification service is down, orders should still process—notifications can be retried later.
Design Documentation
The system design phase produces several artifacts:
- Architecture Diagram: Visual representation of major components and their relationships
- Component Specifications: Detailed description of each component's responsibilities, interfaces, and constraints
- Database Schema: Complete data model with entity relationships, constraints, and indexing strategy
- API Specifications: Endpoint definitions using standards like OpenAPI/Swagger
- Sequence Diagrams: Interaction flows showing how components collaborate for key use cases
- Deployment Diagram: How software components map to hardware/cloud infrastructure
Design Reviews
Before proceeding to implementation, designs undergo formal review. Reviewers evaluate the design against requirements (does it satisfy all functional and non-functional requirements?), assess quality attributes (will it scale? is it secure? is it maintainable?), identify risks (what could go wrong?), and verify feasibility (can this be built within budget and timeline constraints?). Design review findings are cheaper to address than implementation-phase discoveries by an order of magnitude.
Common Design Mistakes
Designing for requirements that do not exist (over-engineering), ignoring non-functional requirements in the design (then discovering performance or security problems during testing), creating tight coupling between components (making future changes expensive), designing without considering deployment and operations concerns, and failing to involve the development team in design decisions (creating designs that are theoretically elegant but practically unimplementable with available skills and tools).
Exam Focus
Revise definitions, diagrams, examples, and short-answer points for System Design Phase.
Interview Use
Prepare one clear explanation, one practical example, and one common mistake for this Software Engineering topic.
Search Terms
software-engineering, software engineering, software, engineering, development, life, cycle, system
Related Software Engineering Topics