Skip to content

EN_CS_Architecture

somaz edited this page Mar 30, 2026 · 1 revision

Q9 & Q12: Clean Architecture and 3-Tier Architecture

Question: Explain Clean Architecture and its layers. Also describe traditional 3-Tier Architecture and how modern web development has changed the boundaries between layers.


Key Terms

Term Description
Clean Architecture Design methodology separating business logic from external interfaces
Entities Core business rules layer (innermost)
Use Cases Application business logic layer
Interface Adapters Converts between use cases and external systems
Frameworks & Drivers Outermost layer — databases, web frameworks, device drivers
3-Tier Architecture Presentation, Application, and Data layers
WAS Web Application Server — handles business logic and dynamic content

Clean Architecture

Introduced by Robert C. Martin ("Uncle Bob"). Keeps business logic independent of frameworks, databases, and UIs.

        ┌─────────────────────────┐
        │   Frameworks & Drivers  │  ← DB, Web, UI, External APIs
        │  ┌───────────────────┐  │
        │  │ Interface Adapters│  │  ← Controllers, Presenters, Gateways
        │  │  ┌─────────────┐  │  │
        │  │  │  Use Cases  │  │  │  ← Application business logic
        │  │  │  ┌───────┐  │  │  │
        │  │  │  │Entities│  │  │  │  ← Core business rules
        │  │  │  └───────┘  │  │  │
        │  │  └─────────────┘  │  │
        │  └───────────────────┘  │
        └─────────────────────────┘

Main Principles

Principle Description
Independence Business logic is independent of UI, DB, and frameworks
Testability Business logic is testable without external elements
Readability Clear, reusable code structure

Layers

Layer Role
Entities Core business objects and rules
Use Cases Implements business logic using Entities
Interface Adapters Bridges use cases with web, DB, and external systems
Frameworks & Drivers Concrete tools: databases, web frameworks, device drivers

3-Tier Architecture

Traditional

Tier Role
Presentation Layer User interface — receives input, displays results
Application Layer Business logic — processes commands, makes decisions
Data Layer Database — stores and retrieves data

Traditional vs Modern Comparison

Aspect Traditional 3-Tier Modern Web Development
Separation Clear layer boundaries Blurred — often combined
Web Server Serves static content only Serves static and dynamic
App Server (WAS) Handles all business logic Embedded in frameworks
Scalability Add intermediary layers Microservices, container nodes
Example Technologies Apache + WebLogic + Oracle Node.js, Spring Boot, Django

Modern frameworks like Spring Boot (Tomcat), Django (Gunicorn), and Node.js embed the application server, removing the need for separate WAS layers.


Reference

Clone this wiki locally