Software Architecture Overview
What is software architecture? Why does it matter? How do architects think about structure, trade-offs, quality, and evolution? A concise overview โ with links to deep dives.
What Is Software Architecture?
Software architecture is the set of significant design decisions about the organisation of a software system โ the major components, their relationships, and the principles guiding their design and evolution.
Structure
- Decomposition into components, modules, and services
- Responsibilities assigned to each building block
- Interfaces that define how blocks communicate
Trade-offs
- Every decision involves trade-offs
- Consistency vs. availability
- Simplicity vs. flexibility
- Performance vs. maintainability
Communication
- How components interact โ sync (REST, gRPC) vs. async (events, queues)
- Protocols, contracts, and data formats
Evolution
- Good architecture accommodates change
- Systems are never "done" โ they evolve with requirements
- Architecture = structure + trade-offs + communication + evolution
- The architect is a collaborative technical leader โ not an ivory-tower decision-maker
- Every decision is a trade-off โ document the rationale, not just the choice
Architecture Styles & Patterns
An architectural style defines the overall shape of a system. Patterns solve specific recurring problems within that shape. Most real systems combine multiple styles and patterns.
Monolithic
- Single deployable unit
- Simple to develop, test & deploy
- Best for small teams & MVPs
- Scaling requires scaling the whole app
Microservices
- Small, independently deployable services
- Each owns its own data & business logic
- Independent scaling & team autonomy
- Distributed system complexity
Event-Driven
- Components communicate via events
- Loose coupling, high scalability
- Event Sourcing & CQRS
- Eventual consistency challenges
Layered / N-Tier
- Presentation โ Business โ Data
- Each layer depends only on layer below
- Well-understood, good for CRUD
- Can lead to tight inter-layer coupling
Serverless
- Code runs in response to events (Lambda)
- Zero server management, auto-scaling
- Pay-per-execution model
- Cold starts & vendor lock-in
Pipes & Filters
- Data flows through a sequence of filters
- Each filter transforms data independently
- Great for ETL & data processing
- Composable & reusable
- Monolith: Start here โ simple, low overhead, good for small teams
- Microservices: Independent deployment & scaling โ but adds distributed system complexity
- Event-Driven: Loose coupling via events โ eventual consistency trade-off
- Layered: Well-understood separation of concerns โ prone to cascade coupling
- Most real systems combine multiple styles and patterns
Core Design Principles
These principles guide good software design across all architectural styles โ from monoliths to microservices, from classes to services.
A class should have only one reason to change. Separate concerns into focused units.
Open for extension, closed for modification. Add behaviour via new classes, not changing existing code.
Subtypes must be substitutable for their base types without altering correctness.
Prefer many specific interfaces over one general-purpose interface. Clients shouldn't depend on methods they don't use.
High-level modules depend on abstractions, not concrete implementations. The foundation of testability.
- Atomicity โ all or nothing
- Consistency โ valid state to valid state
- Isolation โ concurrent txns don't interfere
- Durability โ committed data survives crashes
Use for: financial transactions, inventory
- Basically Available โ system stays up
- Soft State โ state may change over time
- Eventual Consistency โ replicas converge
Use for: social feeds, analytics, caching
Shared vocabulary between devs and business โ used in code, docs, and conversations
Explicit boundary within which a domain model applies. "Order" means different things in Sales vs. Shipping
Cluster of entities treated as a single unit for data changes. One entity is the Aggregate Root
- SOLID โ five principles for maintainable, extensible code at any scale
- CAP theorem โ in distributed systems, choose between CP (consistency) and AP (availability)
- ACID for strong consistency; BASE for distributed, eventually-consistent systems
- DDD โ model complex domains with bounded contexts, ubiquitous language, and aggregates
Designing Systems
Practical patterns and strategies for building scalable, reliable, and maintainable systems โ from caching to consistency.
Scaling
- Vertical: bigger machine (simple, has limits)
- Horizontal: more machines + load balancer
- Read replicas, sharding, auto-scaling
Load Balancing
- Distributes traffic across healthy instances
- L4 (TCP) fast; L7 (HTTP) content-aware
- API Gateway for auth, rate-limiting, routing
Caching
- Cache-Aside: check cache โ miss โ load from DB
- Write-Through: write to both simultaneously
- TTL, eviction (LRU/LFU), CDN for static
| Pattern | How It Works | Trade-off |
|---|---|---|
| Strong Consistency | Every read returns the latest write | Limits availability & performance |
| Eventual Consistency | Reads may be temporarily stale โ replicas converge | Simpler, faster โ but stale reads possible |
| Saga Pattern | Sequence of local transactions + compensating actions | Complex failure modes; no distributed txn |
| Outbox Pattern | Write event to outbox table in same DB transaction | Guarantees atomicity โ needs separate publisher |
Deep dive โ Reducing Coupling (Structural, Instantiation, Call Dependencies)
- Scale horizontally with stateless services behind a load balancer
- Cache aggressively โ Cache-Aside is the most common pattern
- Saga replaces distributed transactions in microservices
- Outbox pattern guarantees atomicity between state change and event publishing
Quality Attributes โ The "-ilities"
Non-functional requirements that define how well a system performs โ often more important than features, and much harder to retrofit.
Scalability
- Handle increased load by adding resources
- Horizontal (more instances) vs. vertical (bigger hardware)
- Measure: requests/sec, concurrent users under target latency
Reliability & Availability
- 99.9% uptime = 8.76 hours downtime/year
- Redundancy, graceful degradation, chaos engineering
- Multi-AZ, replicas, health checks, circuit breakers
Security
- Defence in depth โ network, app, data layers
- AuthN (OAuth2/JWT), AuthZ (RBAC/ABAC)
- Encryption in transit (TLS) & at rest (AES-256)
- Input validation, least privilege, OWASP Top 10
Observability
- Three pillars: Metrics, Logs, Traces
- Distributed tracing with correlation IDs
- SLOs, SLIs, alerting on threshold breaches
- Grafana + Prometheus / CloudWatch
- Quality attributes are designed in by architecture โ not tested in later
- Scalability: stateless services + horizontal scaling
- Reliability: redundancy, graceful degradation, chaos engineering
- Security: defence in depth, least privilege
- Observability: metrics + logs + traces โ the three pillars
Architecture Case Studies
How major companies solve complex architectural challenges at scale โ and what we can learn from their decisions.
- Microservices on AWS โ hundreds of services via REST & event streams
- Open Connect CDN โ custom edge servers at ISPs
- Resilience: Hystrix (circuit breaker), Chaos Monkey (fault injection)
- Data: Cassandra + EVCache + Kafka
- Lesson: Design for failure โ every component has fallback behaviour
- MapReduce โ distributed data processing at massive scale
- Spanner โ globally distributed SQL with strong consistency (TrueTime)
- Borg โ Kubernetes โ internal orchestration โ open source
- Lesson: Build infrastructure abstractions that scale. Invest in platforms
- Fan-out problem: celebrity tweet โ millions of timelines
- Hybrid: fan-out on write for most; fan-out on read for celebrities
- Stack: Scala/JVM, Redis, Kafka, Manhattan (K/V store)
- Lesson: Hybrid strategies beat pure approaches โ optimise for the common case
- Squad model: autonomous cross-functional teams own services end-to-end
- Backstage: internal dev portal for service catalogue (now open-source)
- Data: Kafka + Dataflow + BigQuery for recommendations
- Lesson: Conway's Law in action โ org structure shapes system architecture
- Netflix: design for failure โ circuit breakers, chaos engineering
- Google: invest in infrastructure abstractions that scale
- Twitter: hybrid strategies beat pure approaches
- Spotify: org structure mirrors system architecture (Conway's Law)
What Is Architecture?
- Structure + trade-offs + communication + evolution
- Architect = collaborative technical leader
- Every decision is a documented trade-off
Architecture Styles
- Monolith โ Modular โ Service-Based โ Microservices
- Event-Driven for loose coupling
- Start simple, evolve when needed
Design Principles
- SOLID โ SRP, OCP, LSP, ISP, DIP
- CAP: choose CP or AP in distributed systems
- DDD: bounded contexts, ubiquitous language
Designing Systems
- Scale horizontally with stateless services
- Cache-Aside, Write-Through, CDN
- Saga & Outbox for data consistency
Quality Attributes
- Scalability, reliability, security, observability
- Quality is designed in, not tested in
- Metrics + Logs + Traces = observability
Real-World Lessons
- Netflix: design for failure
- Google: infrastructure abstractions
- Twitter: hybrid fan-out strategies