This document discusses architectural styles and describes the layered pattern. It defines architectural styles as descriptions of component and connector types that constrain how they relate. The layered pattern organizes a system into hierarchical layers, with each layer providing services to the layer above and acting as a client to the layer below. Advantages include independence of layers, reusability, flexibility and maintainability, while disadvantages include potential performance issues with too many layers. Examples given include operating systems and virtual machines.
3. Description
An architectural style or pattern is:
a description of the component and connector types
involved in the style
the collection of rules that constrain and relate
them
4. Layered Pattern
A layered architecture organizes a system into a set of
layers each of which provide a set of services to the
layer “above”.
Layering consists of a hierarchy of layers, each
providing service to the layer above it and serving as
client to the layer below.
Supports the incremental development of sub-systems
in different layers.
When a layer interface changes, only the adjacent
layer is affected
5. Layered Pattern
Context
While working with a large, complex system and you want
to manage complexity by decomposition.
Problem
How do you structure an application to support such
important requirements as maintainability, scalability,
extensibility, robustness, and security?
Solution
Compose the solution into a set of layers. Each layer
should be cohesive and at roughly the same level of
abstraction. Each layer should be loosely coupled to the
layers underneath.
6. Interaction between layers(1)
Interactions among layers are defined by suitable
communication protocols.
Interactions among non-adjacent layers must be kept
to the minimum possible.
Normally layers are constrained so elements only
see:
other elements in the same layer, or
elements of the layer below
7. Interaction between layers(2)
Flow
requests from higher layer to lower layer
answers from lower layer to higher layer
(callbacks)
incoming data or event notification from low to
high
8. Advantages(1)
Independence
Different components of the application can be
independently deployed, maintained, and updated, on
different time schedules
Makes possible for team members to work in parallel on
different parts of the application with minimal
dependencies.
Testing the components independently of each other.
9. Advantages(2)
More secure
Each layer may hide private information from other layers
Reusability
Each layer, being cohesive and is coupled only to lower
layers, makes it easier for reuse by others and easier to be
replaced or interchanged
10. Advantages(3)
Reusing components easily:
For example if we want a windows user interface rather than a web
browser interface, this can be done in an easy and fast way by just
replacing the UI component. All the other components like business
logic, data access and the database remains the same. Layered
architecture allows to swap and reuse components at will.
Increases flexibility, maintainability, and
scalability:
We separate the user interface from the business logic, and the
business logic from the data access logic.
11. Disadvantages
Performance degrades if we have too many layers
(extra overhead of passing through layers and also
changes will pass slowly to higher layers )
Sometimes difficult to cleanly assign functionality to
the “right” layer
Can’t be used for simple applications because it adds
complexity.
12. Examples
Virtual Machines
APIs
Information systems – lower layer is database
Presentation
Application logic
Domain layer
Database
Some operating systems – Windows NT
13. Example 1 :
Layered Architecture for OS
(Sample)
Resource (I/O,
network, file, etc.)
management
Utilities (editors,
sys commands,
compilers,
internet
access,
libraries, etc.)
Kernel (Device & memory
Processing) drivers
Process (classification &
management)
14. Example 2 :
Java VM
Java
Java
Operating
Processor
System
Virtual Machine
Application