Download as pdf or txt
Download as pdf or txt
You are on page 1of 28

 Layered Architecture

 Virtual Machine
 Interaction Architecture
◦ Model View Controller
 In a layered architecture the
system is decomposed into a
number of higher and lower
layers in a hierarchy.
 Each layer consists of a group
of related classes that are
encapsulated in a package.
 Each layer has its own sole
responsibility in the system.
 Each layer has 2 interfaces:
◦ The up interface provides services to its upper
layer and the low interface requires services
from its lower layer.
 In a pure layered hierarchy, each layer
only provides services to the adjacent
upper layer and only requests services
from the adjacent layer directly below.
 A simple software system may consist of two layers:
◦ An interaction layer and a processing layer
 The interaction layer provides user interfaces to
clients, takes requests, validates and forwards
requests to the processing and responds to clients.
 The processing layer receives the forwarded requests
and performs the business logic process, access the
database, return the results to its upper layer and let
the upper layer respond to clients since the upper
layer has the GUI interface responsibility.
 Abstraction
 Encapsulation
 Clearly defined functional layers
 Reusable
 High cohesion
 Loose coupling
 Abstraction. Layered architecture abstracts the
view of the system as whole while providing
enough detail to understand the roles and
responsibilities of individual layers and the
relationship between them.
 Encapsulation. No assumptions need to be made
about data types, methods and properties, or
implementation during design, as these features
are not exposed at layer boundaries.
 Clearly defined functional layers. The
separation between functionality in each layer is
clear. Upper layers such as the presentation layer
send commands to lower layers, such as the
business and data layers, and may react to events
in these layers, allowing data to flow both up and
down between the layers.
 High cohesion. Well-defined responsibility
boundaries for each layer, and ensuring that each
layer contains functionality directly related to the
tasks of that layer, will help to maximize cohesion
within the layer.
 Reusable. Lower layers have no dependencies on
higher layers, potentially allowing them to be
reusable in other scenarios.
 Loose coupling. Communication between layers
is based on abstraction and events to provide
loose coupling between layers.
 Incremental Software development based on
increasing levels of development
 Enhanced independence of upper layer to lower
layer since there is no impact from the changes of
lower level services as long as their interfaces
remain unchanged.
 Component based technology is suitable to
implement Layered architecture.
 Interchangeability and reusability are enhanced
due to separation of standard interface and its
implementation.
 Lower runtime performance.
 Errors and exception handling are issues
 Breach of interlayer communication may cause
deadlocks, and bridging may cause tight coupling.
 A virtual machine separates a
programming language from an
executable platform.
 This chapter focuses on software
architecture that best supports user
interaction.
 The interaction oriented software
architecture decomposes the system into
three major partitions:
◦ data module, control module and view
presentation module
 Each module has its own sole responsibility.
 The data module provides the data abstraction
and all core business logic on data processing.
 The view presentation module is responsible for
◦ Visual or audio data output and
◦ May also provide user input interface
 The control module determines the flow of control
involving
◦ View selection, communication between modules, data
initialization etc etc
 Two major style categories are
◦ Model-View-Controller
◦ Presentation-Abstraction-Control
 The two models are similar in sense that they
propose three component decomposition:
◦ Presentation module of PAC is like View module of MVC
◦ Abstraction module of PAC is like Model module of MVC
◦ Control module of PAC is like Controller module of MVC
 Both PAC and MVC are used for interactive
applications such as web online application etc.
 They differ in their flow of control and organization.
 MVC architecture is used in applications where
user interfaces are prone to data changes.
 Example:
◦ Java swing component and Java swing layout managers
are designed using MVC architecture
 The domain-specific representation of the
information on which the application operates.
 The model is another name for the application
logic layer (sometimes also called the domain
layer). Application (or domain) logic adds meaning
to raw data (e.g., calculating if today is the user’s
birthday, or the totals, taxes and shipping charges
for shopping cart items).
 Many applications use a persistent (permanent)
storage mechanism (such as a database) to store
data.
 Renders the model into a form suitable for
interaction, typically a user interface element.
 MVC is often seen in web applications, where the
view is the HTML page and the code which
gathers dynamic data for the page.
 Processes and responds to events, typically user
actions, and may invoke changes on the model
and view.
 System is decomposed into two subsystems:
◦ The Controller-View and the Model
 The Controller-View takes care of input and output
processing and their interfaces.
 The model module copes with all core functionality
and the data.
 The controller-view module register with the data
module.
 The model module notifies the Controller-View
module of any changes so that graphics data
display will be changed.
Controller/
Model Database
View
 The model module provides all the core
functionality and data supported by database.
 The view module displays the data.
 The controller module takes input requests,
validates input data, initiates the Model and View
and their connection etc.
 The controller and the view register with the Model
module.
 Whenever the data in the model module is
changed, the view module and the controller
module are notified of changes.
 The Model module plays an active role in MVC-II
as in MVC-I
 In MVC-II the view and Controller module are
separate.
 This allows for the division of labor.
 For Example
◦ The programming expert can work on the development of
Controller while the graphics interface design expert can
work on the development of view.
Questions???

You might also like