Phase 2 of 5  ·  Design & Modeling
Week 06 / 20   ·   Ch 6

Architectural
Design

"MVC, Layered, Microservices — your app's skeleton matters more than you think"

📚 Ch 6 — Architectural Design🏛️ 5 Patterns👁️ 4+1 Views⏱ ~20 min read

🔍Concept Deep Dives

Click each concept to expand — real examples, diagrams, pros & cons.

🎮

Model-View-Controller

Separates data (Model), presentation (View), and user interaction (Controller).

When to Use

Web apps, any UI-heavy system, when data and presentation may change independently.

Real-World Example

Django, Rails, Laravel, Spring MVC — every major web framework is built on MVC.

✓ Advantages

  • Data independent of UI
  • Multiple views of same data
  • Testable components

⚠ Watch Out

  • Overkill for simple apps
  • Can lead to bloated controllers
User→Controller→Model ↓ ↓ View←state change
🍰

Layered Architecture

System organized into layers — each layer only uses the layer directly below it.

When to Use

Enterprise apps, multi-team development, multilevel security requirements.

Real-World Example

Most web applications: UI → Business Logic → Data Access → Database.

✓ Advantages

  • Swap layers without touching others
  • Portable
  • Incremental development

⚠ Watch Out

  • Layer-skipping in practice
  • Performance overhead
┌──── UI ────┐ ┌── Business ─┐ ┌─── Data ────┐ ┌─── DB ──────┐
🗃️

Repository Pattern

All components share a central data store. No direct component-to-component communication.

When to Use

IDEs, data-driven tools, large volumes of shared data.

Real-World Example

Git repositories, IDEs (shared symbol table), database management systems.

✓ Advantages

  • Independent components
  • One change propagates everywhere
  • Consistent data

⚠ Watch Out

  • Single point of failure
  • Hard to distribute
Tool A ──┐ Tool B ──┼──→ [Repository] Tool C ──┘
🔗

Client–Server

Services delivered by servers. Clients request services via network.

When to Use

Shared database from many locations, web apps, variable load.

Real-World Example

Every web app, REST API, email system, DNS.

✓ Advantages

  • Distributed
  • Add servers without touching clients

⚠ Watch Out

  • Server = single point of failure
  • Network dependency
Client 1 ─┐ Client 2 ─┼→[Network]→[Server] Client 3 ─┘
🏭

Pipe and Filter

Data flows through sequential transformation stages. Each filter does one job.

When to Use

Batch processing, ETL, compilers, CI/CD pipelines.

Real-World Example

Unix pipes, compilers, data ETL, billing systems.

✓ Advantages

  • Easy to understand
  • Add a stage = add a filter
  • Can be parallel

⚠ Watch Out

  • All filters must agree on data format
  • Bad for interactive UIs
Input→[Filter1]→[Filter2]→[Filter3]→Output

📋Quick Reference

θ Ch 6 Cheat Sheet — Architectural Design
Architecture
Description of system structure: components + connections + why. Skeleton of your app.
MVC
Model (data), View (display), Controller (input). Foundation of web frameworks.
Layered
Strict hierarchy. Each layer calls only the one below. Enterprise standard.
Repository
Central shared data store. Components independent. Single point of failure risk.
Client–Server
Services + requesters + network. Servers don't know clients.
Pipe and Filter
Sequential transforms. Each filter = one job. Great for batch and ETL.
4+1 Views
Logical, Process, Development, Physical + Scenarios. Build only what helps communication.
θ
Sommerville's Key Points — Ch 6
Author's own summary from the end of the chapter.
  • 1Architecture: description of how a software system is organized. Affects performance, security, availability.
  • 2Architecture design decisions: type of application, distribution, patterns, documentation.
  • 34+1 Views: logical, process, development, physical, + scenarios (Kruchten).
  • 4Architectural patterns: MVC, Layered, Repository, Client-Server, Pipe and Filter.
  • 5Transaction processing systems: database-centered, atomic operations, ATMs/e-commerce.
  • 6Language processing systems: compilers — lex → parse → semantic → codegen.

🧠Quiz — Test Yourself

Think through your answer first, then reveal.

Q1
Recall
What is the key tension between performance and maintainability in architecture?
Performance wants large, co-located components (fewer hops). Maintainability wants small, independent components (easier to change). You cannot fully optimize both — pick your priority based on requirements.
Q2
Apply
You're building a data pipeline: read CSV → filter rows → aggregate → write to DB. Which pattern?
Pipe and Filter. Each step is a discrete transformation. Data flows sequentially through filters. Easy to add, remove, or reorder stages.
Q3
Analyze
A startup wants microservices on day 1 for their MVP. What do you tell them?
Don't. Martin Fowler: 'Don't consider microservices unless you have a system too complex to manage as a monolith.' Start layered monolith. Split when pain becomes real.
Up Next → Week 07
Design and Implementation
Why clean code isn't enough — design matters
Continue → Week 07