SE Notes
High-level system structure and component organization.
Architectural design defines the high-level structure of a software system—identifying the major components, their responsibilities, and how they interact. It is the most consequential design activity because architectural decisions are the hardest to change later. Choosing between a monolithic architecture and microservices, between a relational database and a document store, or between synchronous and asynchronous communication fundamentally shapes every subsequent design and implementation decision. Getting architecture right is worth significant upfront investment because architectural mistakes discovered during testing or production are enormously expensive to correct.
What Software Architecture Encompasses
Architecture addresses the system's fundamental structural decisions:
Component Identification: What are the major building blocks? A web application might have a presentation layer, business logic layer, data access layer, and external integration layer. A distributed system might have dozens of independent services.
Component Responsibilities: What does each component do? Clear responsibility assignment prevents overlap (two components doing the same thing) and gaps (no component handling a needed function).
Component Interactions: How do components communicate? Through direct method calls, REST APIs, message queues, shared databases, or event streams? The interaction patterns determine coupling, performance, and reliability characteristics.
Quality Attribute Satisfaction: How does the architecture achieve non-functional requirements? Performance (caching layers, load balancing), security (authentication services, encryption), availability (redundancy, failover), and scalability (horizontal scaling, partitioning) are all architectural concerns.
Common Architectural Patterns
Layered Architecture
The most traditional pattern organizes code into horizontal layers with each layer providing services to the layer above and consuming services from the layer below:
Each layer can only call the layer directly below it. This constraint creates clean separation of concerns but can introduce performance overhead from passing through multiple layers.
Client-Server Architecture
Separates the system into clients that request services and servers that provide them. The web is the quintessential client-server system—browsers (clients) request resources from web servers.
Microservices Architecture
Decomposes the system into small, independently deployable services, each owning its data and implementing a bounded business capability. Services communicate via lightweight protocols (REST, gRPC, messages).
Event-Driven Architecture
Components communicate by producing and consuming events through an event broker. Producers do not know who consumes their events, enabling loose coupling and easy addition of new consumers without modifying producers.
Pipe-and-Filter Architecture
Data flows through a sequence of processing steps (filters) connected by channels (pipes). Each filter transforms its input and passes the result to the next filter. Unix command-line pipelines and data processing systems use this pattern.
Real-World Example: Netflix Architecture
Netflix's architecture demonstrates microservices at scale:
- API Gateway (Zuul): Single entry point handling routing, authentication, and rate limiting
- Hundreds of microservices: Each team owns services for their domain (recommendations, playback, user profiles, billing)
- Event-driven communication: Apache Kafka handles inter-service events (user watched a show → update recommendations)
- Data isolation: Each service owns its database—no shared databases between services
- Resilience patterns: Circuit breakers (Hystrix) prevent cascading failures, retry mechanisms handle transient errors
- Global distribution: Content delivery network (CDN) serves video from edge locations near users
Architectural Quality Attributes
Architecture directly determines a system's quality characteristics:
| Quality Attribute | Architectural Tactic |
|---|---|
| Performance | Caching, load balancing, async processing |
| Scalability | Horizontal scaling, partitioning, stateless services |
| Availability | Redundancy, failover, health checking |
| Security | Authentication layer, encryption, network segmentation |
| Maintainability | Modularity, loose coupling, clear interfaces |
| Testability | Dependency injection, interface-based design |
Architecture Documentation
The "4+1" View Model documents architecture from multiple perspectives:
- Logical View: Functional decomposition (class diagrams, package diagrams)
- Process View: Concurrency and synchronization (activity diagrams, sequence diagrams)
- Development View: Software organization for developers (component diagrams, package structure)
- Physical View: Deployment topology (deployment diagrams)
- +1 Scenarios: Use cases that exercise the architecture (sequence diagrams for key scenarios)
Architecture Decision Records (ADRs)
Each significant architectural decision should be documented:
# ADR-003: Use PostgreSQL for primary data store
## Status: Accepted
## Context: We need a database for user accounts, orders, and products.
## Decision: Use PostgreSQL over MongoDB.
## Rationale:
- Strong consistency needed for financial transactions
- Complex queries required for reporting
- Team has PostgreSQL expertise
- Mature tooling and hosting options
## Consequences:
- Schema changes require migrations
- Horizontal scaling requires more planning than MongoDB
- Excellent JOIN performance for complex queriesCommon Architectural Mistakes
Over-engineering (building for scale you do not need yet), under-engineering (ignoring quality attributes until crisis), big ball of mud (no discernible structure), resume-driven development (choosing technology for personal learning rather than project needs), and failing to consider operational concerns (how will this be deployed, monitored, and debugged in production?).
Exam Focus
Revise definitions, diagrams, examples, and short-answer points for Architectural Design.
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, design, architectural, architectural design
Related Software Engineering Topics