Chapritre 4 Software Achitecture Layered Architecture
Chapritre 4 Software Achitecture Layered Architecture
Architecture:
Layered
Architecture
Course objectives
Understanding Layered
Architecture
Description
Components within the layered architecture
pattern are organized into horizontal layers, each
layer performing a specific role within the
application (e.g., presentation logic or business
logic). Although the layered architecture pattern
does not specify the number and types of layers
that must exist in the pattern, most layered
architec‐ tures consist of four standard layers:
presentation, business, persis‐ tence, and database
Figure.
Layered architecture styled
Description
Presentation layer: This is the layer that interacts with users through screens, forms, menus,
reports, etc. It is the most visible layer of the application. It defines how the application looks.
Business rules layer: This layer contains rules that determine the behavior of the whole
application, such as, “If an invoice is printed, then send an email to the customer, select all items
sold, and decrease their stock in the stock management module.”
The persistence layer is responsible for storing data and files. It gets the data from the database
or the hard drive and sends it back to the business layer which then sends it back to the
presentation layer.
Database layer: This layer contains the tables, indexes, and data managed by the application.
Searches and insert/delete/update operations are executed here.
Keys Concepts
One of the powerful features of the layered architecture pattern is the separation of concerns among
components. Components within a specific layer deal only with logic that pertains to that layer.
Keys Concepts(Closed Layers and request access)
Notice in Figure that each of the layers in the architecture is marked as being closed. This is a very
important concept in the lay‐ ered architecture pattern. A closed layer means that as a request moves
from layer to layer, it must go through the layer right below it to get to the next layer below that one
Keys Concepts(Layered of Isolation)
The layers of isolation concept means that changes made in one layer of the architecture generally
don’t impact or affect components in other layers
The layers of isolation concept also means that each layer is inde‐ pendent of the other layers, thereby
having little or no knowledge of the inner workings of other layers in the architecture.
Example
Advantages and Disadvantages
There are several advantages to using layered architecture:
Layers are autonomous: A group of changes in one layer does not affect the others. This
is good because we can increase the functionality of a layer, for example, making an
application that works only on PCs to work on phones and tablets, without having to
rewrite the whole application.
Layers allow better system customization.
Layers make an application more difficult to maintain. Each change requires analysis.
Layers may affect application performance because they create overhead in execution:
each layer in the upper levels must connect to those in the lower levels for each
operation in the system.
When Would I Use Layered Architecture?