Intermediate Topic 31 of 50 Software Engineering
Layered Architecture
Organizing code into stacked responsibility tiers.
How it works
Layered architecture organizes a system into horizontal layers with distinct responsibilities, commonly presentation, application or business logic, domain and data access. Each layer depends only on the layer below it, which gives separation of concerns, easier testing and replaceable parts such as swapping a database. Strict layering allows calls only to the next layer, while relaxed layering lets higher layers use any lower one.
Step-by-step walkthrough
- The user interface is the top layer.
- It calls the business layer.
- The business layer applies rules and calls the data layer.
- The data layer talks to the database.
- Each layer depends only on the one below, which separates concerns.
Where it is used
Enterprise applications, web back ends and many frameworks use this style as a familiar default that new team members understand quickly.
Common pitfall
Layers can become pass-through code that adds boilerplate without value, called the sinkhole anti-pattern. Business logic leaking into the presentation or database layer, and lower layers depending on upper ones, erode the structure. Changes that span all layers are tedious. Keep dependencies pointing one way and consider clean or hexagonal architecture to protect the domain.
Where it fits in the course
Layered Architecture is topic 31 of 50 in Software Engineering, rated Intermediate. It follows Code Smells. The next topic is Clean Architecture.
Practice and explore
- Open the interactive lesson, with a mini quiz.
- Take the Software Engineering quiz.
How to study this topic
- Read the explanation above and restate the definition in your own words.
- Open the interactive lesson and answer its mini quiz.
- Read the common pitfall, then write a short example that avoids it.
- Check your understanding in the Software Engineering quiz, and revisit the topic if you miss a question.
Frequently asked questions
What is Layered Architecture?
Where do people use Layered Architecture?
What is the most common mistake with Layered Architecture?
What should I learn before this topic?
How can I practice it?
Is Layered Architecture hard to learn?
How long does it take to learn Layered Architecture?
Which topics are related to Layered Architecture?
What should I study after Layered Architecture?
Related topics
- Code Smells (Software Engineering)
- Clean Architecture (Software Engineering)
- Technical Debt (Software Engineering)
- Domain-Driven Design (Software Engineering)
- Von Neumann Architecture (Computer Architecture & Logic)
- Instruction Set Architecture (Computer Architecture & Logic)
- IoT Architecture (Mobile, Embedded & IoT)