SE Notes
Common architectural patterns for organizing software systems.
An architecture style is a named collection of design decisions and constraints that define a family of system structures with similar characteristics. Choosing an architecture style is one of the most consequential decisions in software development—it determines how the system scales, how teams organize, how components communicate, and how easily the system can evolve. Different styles make different tradeoffs, and no single style is optimal for all situations. Understanding the options and their tradeoffs enables informed architectural decisions.
Monolithic Architecture
The entire application is built and deployed as a single unit. All functionality resides in one codebase, one deployment artifact, and one process.
Characteristics: Simple deployment, straightforward development for small teams, easy debugging (single process), consistent data management (single database, ACID transactions).
When to use: Small applications, early-stage startups, small teams (under 10 developers), applications where simplicity outweighs scalability concerns.
Limitations: Scaling requires replicating the entire application (cannot scale individual features independently). Large codebases become difficult for teams to work on without conflicts. A bug in one component can crash the entire system. Technology choices are system-wide (cannot use different languages for different components).
Layered (N-Tier) Architecture
Organizes the system into horizontal layers where each layer has a specific role and communicates only with adjacent layers:
Characteristics: Clear separation of concerns, layers can be developed independently, easy to understand and teach, natural mapping to team organization (frontend team, backend team, DBA team).
When to use: Enterprise applications with clear functional separation, teams organized by technical specialty, applications where changes typically affect one layer.
Limitations: Changes to a data entity often cascade through all layers. Performance overhead from passing through multiple layers. Tendency toward "distributed monolith" where layers are too tightly coupled.
Microservices Architecture
Decomposes the application into small, independently deployable services organized around business capabilities:
Characteristics: Independent deployment and scaling, technology diversity (each service can use different languages/databases), team autonomy (each team owns their services end-to-end), fault isolation (one service failure does not crash others).
When to use: Large applications with multiple teams, systems requiring independent scaling of different features, organizations with strong DevOps culture, products with diverse technology needs.
Limitations: Distributed system complexity (network failures, data consistency, distributed debugging), operational overhead (many services to deploy and monitor), eventual consistency challenges, and inter-service communication latency.
Event-Driven Architecture
Components communicate by producing and consuming events through an event broker:
| [Producer A] ──event── | [Event Broker] ──event──→ [Consumer X] |
| [Producer B] ──event── | [ (Kafka) ] ──event──→ [Consumer Y] |
| ──event── | [Consumer Z] |
Characteristics: Loose coupling (producers do not know consumers), easy to add new consumers without modifying producers, natural fit for asynchronous processing, excellent for real-time data streaming.
When to use: Systems with complex event processing (IoT, financial trading), applications requiring real-time reactions to data changes, systems with many independent consumers of the same events.
Limitations: Debugging event chains is difficult (where did this event come from? who consumed it?), eventual consistency requires careful design, event ordering can be challenging, and testing event-driven systems requires specialized approaches.
Service-Oriented Architecture (SOA)
An older pattern where enterprise capabilities are exposed as reusable services communicating through an Enterprise Service Bus (ESB):
When to use: Large enterprises integrating multiple legacy systems, organizations with strong governance requirements, systems requiring complex message routing and transformation.
Differences from microservices: SOA services tend to be larger, share databases, communicate through heavyweight middleware (ESB), and are governed centrally. Microservices are smaller, own their data, use lightweight protocols, and are governed by individual teams.
Real-World Architecture Selection
Startup building MVP: Monolithic—fastest to develop, simplest to deploy, adequate for initial scale.
Growing company (50 developers): Begin decomposing into a few key services (authentication, payments, core business logic) while keeping less critical features in the monolith.
Enterprise (500+ developers): Full microservices with event-driven integration between domains. Each team owns 2-5 services with full deployment autonomy.
IoT Platform: Event-driven architecture with edge computing (devices produce events) and microservices backend (different services process different event types).
Architecture Decision Factors
| Factor | Favors Monolith | Favors Microservices |
|---|---|---|
| Team Size | Small (< 10) | Large (50+) |
| System Complexity | Low-Medium | High |
| Scaling Needs | Uniform | Variable per feature |
| Deployment Frequency | Monthly | Daily/Hourly |
| Team Autonomy | Low priority | High priority |
| Operational Maturity | Low | High (strong DevOps) |
Hybrid Approaches
Most real systems use hybrid approaches—a modular monolith that extracts performance-critical components into separate services, or microservices with a shared events backbone. The choice is not binary; it is a spectrum, and systems often evolve from simpler to more distributed architectures as complexity and team size grow.
Exam Focus
Revise definitions, diagrams, examples, and short-answer points for Software Architecture Styles.
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, architecture, styles, software architecture styles
Related Software Engineering Topics