Layered Architecture Flashcards
What is layering?
Layering is a common practice to separate and organise code units by their role/responsibilities in the system.
How does a layered system is organized is broad strokes?
In a layered system, each layer:
- Depends on the layers beneath it;
- Is independent of the layers on top of it, having no knowledge of the layers using it.
What are the advantages of the Layered Architecture?
- We only need to understand the layers beneath the one we are working on;
- Each layer is replaceable by an equivalent implementation, with no impact on the other layers;
- Layers are optimal candidates for standardisation;
- A layer can be used by several different higher-level layers.
What are the disadvantages of the Layered Architecture?
- Layers can not encapsulate everything (a field that is added to the UI, most likely also needs to be added to the DB);
- Extra layers can harm performance, especially if in different tiers.
What is the Lasagna Architecture?
Lasagna Architecture is the name commonly used to refer to the anti-pattern for Layered Architecture
What’s the difference between tier and layer?
Tier is a physical unit, where the code / process runs. E.g.: client, application server, database server;
Layer is a logical unit, how to organize the code. E.g.: presentation (view), controller, models, repository, data access.