Why Layered Architecture Matters: Benefits, Drawbacks, and Design Principles
This article explores the essence of layered architecture, explaining why layering is used, its advantages and disadvantages, core design principles, and practical ways to apply logical and physical layers in real‑world software projects.
Background
Understanding the essence of layered architecture helps architects think deeply from evolution and core concepts, enabling them to apply the right approach to projects.
Why Layer
Layering introduces decoupling and classification, solving unclear responsibilities and excessive coupling; it provides a basis for team division and collaboration.
Benefits of Layering
Isolates business complexity from technical complexity, allowing independent evolution.
Clear responsibilities reduce coupling, improve reusability, maintainability, and partial extensibility.
Facilitates team division and cooperation.
Drawbacks of Layering
Increases code comprehension difficulty.
Potential performance loss due to multi‑layer calls.
Higher management cost for defining boundaries and handling team structure.
How to Layer
Layering is an abstraction where each layer represents a concern; collaboration among layers forms the call chain.
Layer by differing responsibilities (concerns).
Layer by degree of change.
Place components of the same abstraction level in the same layer.
Design Ideas Within Layers
High cohesion and loose coupling are the guiding ideas, expressed through:
Single Responsibility Principle – each layer does one thing.
Open/Closed Principle – layers are open for extension, closed for modification.
Dependency Inversion Principle – depend on abstractions, not concrete implementations.
Types of Layering
Physical Layering (Tier)
Physical layering considers deployment and project structure, such as the classic J2EE N‑tier architecture.
Typical large distributed system tier diagram.
Logical Layering (Layer)
Common logical layer models include three‑layer, four‑layer, and seven‑layer architectures.
Detailed Layer Example (Four‑Layer Architecture)
Each layer’s focus and responsibilities:
Presentation Layer – Handles user interaction and page rendering; receives input, calls business logic, and renders results.
Business Logic Layer – Core domain model and business rules; implements transactions, calls the resource integration layer.
Resource Integration Layer – Manages data access, external APIs, and device interaction.
Code‑Level Design
Use VO, BO, and Entity classes (often shared). Abstract business logic via Logic interfaces; Service implements specific logic, enabling maximum decoupling and reuse.
Additional patterns:
Place reusable Logic in a Manager for shared use.
Wrap multiple services with a Facade to aggregate calls.
Resource integration layer may use Proxy, Strategy, and Adapter patterns for database access and external calls.
Layer Interaction
Standard call order follows top‑down invocation; cross‑layer calls are possible but circular dependencies should be avoided.
Physical vs Logical Layer Relationship
Logical layers can be deployed together, partially separated, or fully separated, introducing RPC calls and high‑availability concerns.
Conclusion
Layered architecture is one of the most widely used patterns; its core idea is classification and decoupling. The number of layers is flexible—two, three, four, five, six, or more—depending on project needs. Understanding the concepts from theory to implementation enables architects to apply layered design effectively and elevate their engineering capabilities.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
ITFLY8 Architecture Home
ITFLY8 Architecture Home - focused on architecture knowledge sharing and exchange, covering project management and product design. Includes large-scale distributed website architecture (high performance, high availability, caching, message queues...), design patterns, architecture patterns, big data, project management (SCRUM, PMP, Prince2), product design, and more.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
