Chapter 5 Style

You might also like

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 77

Chapter Five

Software
Architectural Style
1
Data Flow Architecture
It views the entire software system as a series
of transformations on successive sets of data
The software system is decomposed into data
processing elements
Each component in this architecture transforms
its input data into corresponding output data
The connection between the subsystem
components may be implemented as I/O
streams, I/O files, buffers, piped streams, or
other types of connections.
2 The data moves from one subsystem to another
Cont…
Three subcategories in the data flow
architecture styles. These are:
Batch sequential
Pipe and filter
Process control

3
Batch sequential
Represents a traditional data processing model
that was widely used from 1950 to 1970
Each data transformation subsystem or
module cannot start its process until its
previous subsystem completes its computation.
Data flow carries a batch of data as a whole
from one subsystem to another
The architecture is in a linear data flow order

4
Cont…
Applicable domains of batch sequential
architecture:
Data are batched.
Intermediate file is a sequential access file.
Each subsystem reads related input files and
writes output files.
Benefits:
Simple divisions on subsystems.
Each subsystem can be a stand-alone program
working on input data and producing output
5
data.
Cont…
Limitations:
Implementation requires external control.
It does not provide interactive interface.
Concurrency is not supported and hence
throughput remains low
High latency.

6
Pipe and Filter Architecture
The flow is driven by data.
It decomposes the whole system into components of data
source, filters, pipes, and data sinks.
The connections between components are data streams.
A data stream is a first-in/first-out buffer which can be a
stream of bytes, characters, or even records of XML.
Most operating systems and programming languages
provide a data stream
Each filter is an independent data stream transformer; it
reads data from its input data stream, transforms and
processes it
A pipe moves a data stream from one filter to another.
7
A pipe can carry binary or character streams.
Cont…
There are three ways to make the data flow:
Push only (Write only)
A data source may push data in a
downstream.
A filter may push data in a downstream.
Pull only (Read only)
A data sink may pull data from an upstream.
A filter may pull data from an upstream.
Pull/Push (Read/Write)
A filter may pull data from an upstream and
8
Cont…
There are two types of filters: active and passive.
An active filter pulls in data and pushes out the
transformed data (pull/push); it runs independently (Unix
filter)
A passive filter lets connected pipes push data in and pull
data out. It depend on another to activate(via calls)
It works with active pipes that pull/push into the next
filter.
Class diagram

9
Cont…
Applicable domains of pipe and filter
architecture:
The system can be broken into a series of
processing steps over data streams, and at each
step filters consume and move data incrementally.
The data format on the data streams is simple,
stable, and adaptable if necessary.
Significant work can be pipelined to gain
increased performance.
Producer or consumer-related problems are being
10
addressed.
Cont…
Benefits:
Concurrency: It provides high overall throughput for
excessive data processing.
Reusability: Encapsulation of filters makes it easy to
plug and play, and to substitute.
Modifiability: It features low coupling between filters,
less impact from adding new filters.
Simplicity: It offers clear division between any two
filters connected by a pipe.
Flexibility: It supports both sequential and parallel
execution.
11
Cont…
Limitations:
It is not suitable for dynamic interactions.
A low common denominator is required for data
transmission in the ASCII formats since filters may
need to handle data streams in different formats, such
as record type or XML type rather than character type.
Overhead of data transformation among filters such as
parsing is repeated in two consecutive filters.
It can be difficult to configure a pipe and filter system
dynamically.

12
Process Control Architecture
It is suitable for the embedded system software design
where the system is manipulated by a process control
variable data.
It decomposes the whole system into subsystems
(modules) and connections between subsystems.
There are two types of subsystems: an executor
processing unit for changing process control variables
and controller unit for calculating the amounts of the
changes.
Shows the data flow of a feedback close-loop process
control system.
The connections between the subsystems are the data
flow.
13
A process control system must have the following
Cont …
A process control system must have the following
process control data:
Controlled variable: a target controlled variable
such as speed in a cruise control system or the
temperature control system.
It has a set point goal to reach. The controlled
variable data should be measured by sensors as a
feedback reference to recalculate manipulated
variables.
Input variable: a measured input data such as the
temperature of return air in a temperature control
system.
14
Manipulated variable: can be adjusted by the
Feedback Loop control system

15
Data-centered architecture
The data is centralized and accessed frequently by
other components, which modify data.
The main purpose is to achieve integrality of data.
It consists of different components that communicate
through shared data repositories.
The components access a shared data structure and are
relatively independent,
There are two types of components
A central data structure or data store or data
repository
A data accessor operate on the central data store,
perform computations
16
Have two categories as Repository Architecture
Repository Architecture Style
The data store is passive and the clients software
components are active, which control the logic flow.
The participating components check the data-store
for changes.
A client sends a request to the system to perform
actions
e. g. insert data.
The computational processes are independent and
triggered by incoming requests
It is widely used in database management systems,
library information systems, the interface repository
(IR) in CORBA, the UDDI registry for web services,
17
compilers, and Computer Aided Software
Cont…

18
Cont..
Applicable domains of repository architecture:
Suitable for large, complex information systems
Requires data transactions to drive the control flow
of computation
Benefits:
Data integrity: easy to back up and restore
System scalability and reusability of agents: easy
to add new software components because they do
not have direct communication with each other
Reduces the overhead of transient data between
19 software components
Cont..
Limitations:
Data store reliability and availability are important
issues. Centralized repository is vulnerable to failure
compared to distributed repository with data
replication.
High dependency between data structure of data store
and its agents.
Data evolution is more difficult and expensive.
Cost of moving data on network if data is distributed.
Related architecture:
Layered, multi-tier, and MVC

20
Blackboard Architecture Style

It has a blackboard component, acting as a central data


repository,
A number of components that act independently on the
common data structure are stored in the blackboard.
The datastore alerts the clients whenever there is a data-
store changes.
When changes occur in the data, the system sends the
notifications known as trigger and data to the clients.
Widely used in certain AI applications and complex
applications, such as speech recognition, image
recognition, security system, and business resource
21 management systems etc.
Cont…
The blackboard model defines three main components:
Blackboard - a structured global memory containing
objects from the solution space
Knowledge sources - specialized modules with their own
representation
Control component - selects, configures and executes
modules

22
Cont…
Related architecture:
Implicit invocation architecture such as event-
based, MVC architecture
Benefits:
Scalability: easy to add or update knowledge
source.
Concurrency: all knowledge sources can work in
parallel since they are independent of each other.
Supports experimentation for hypotheses.
Reusability of knowledge source agents.
23
Cont…
Limitations:
Due to the close dependency between the blackboard
and knowledge source, the structure change of the
blackboard may have a significant impact on all of its
agents.
Since only partial or approximate solutions are
expected, it can be difficult to decide when to
terminate reasoning.
Synchronization of multiple agents is an issue. Since
multiple agents are working and updating the shared
data in the blackboard simultaneously, the preference
or priority of executions of multiple agents must be
24 coordinated.
Hierarchical architecture
It views the whole system as a hierarchy structure, in
which the software system is decomposed into logical
modules
It used in designing system software such as network
protocols and operating systems.
A low-level subsystem gives services to its adjacent
upper level subsystems, which invoke the methods in the
lower level.
The lower layer provides more specific functionality
such as I/O services, transaction, scheduling, security
services, etc.
The middle layer provides more domain dependent
25 functions such as business logic and core processing
Types of Hierarchical architectural
1. Main-subroutine
2. Master-slave
3. Virtual machine
Main-subroutine
The aim is to reuse the modules and freely develop
individual modules or subroutine.
A software system is divided into subroutines by using
top-down refinement
There are two ways by which data is passed as parameters
to subroutines, namely
Pass by Value − Subroutines only use the past data, but
can’t modify it.
26
Pass by Reference − Subroutines use as well as change
Cont…

27
Cont…
Benefits:
It is easy to decompose the system based on the
definition of the tasks in a top-down refinement
manner.
This architecture can still be used in a subsystem
of OO design.
Limitations:
Globally shared data in classical main-subroutines
introduces vulnerabilities.
Tight coupling may cause more ripple effects of
28 changes as compared to OO design.
Master-Slave
It follows divide and conquer principle and supports
fault computation and computational accuracy.
It is a modification of the main-subroutine
architecture that provides reliability of system and
fault tolerance.
The slaves provide duplicate services to the master,
and the master chooses a particular result among
slaves by a certain selection strategy.
The slaves may perform the same functional task by
different algorithms and methods or totally different
functionality.
It includes parallel computing in which all the slaves
29
can be executed in parallel.
Cont…

30
Cont…
The implementation of the Master-Slave pattern
follows five steps −
1. Specify how the computation of the task can be
divided into a set of equal sub-tasks and identify the
sub-services.
2. Specify how the final result of the whole service
can be computed.
3. Define an interface for the sub-service identified in
step 1.
4. Implement the slave components according to the
specifications developed in the previous step.
31 5. Implement the master according to the
Cont…
Applications
Suitable for applications where reliability of software is
critical issue.
Widely applied in the areas of parallel and distributed
computing.
Benefits
Faster computation and easy scalability.
Provides robustness as slaves can be duplicated.
Slave can be implemented differently to minimize
semantic errors.
Limitation
Communication overhead.
32Not all problems can be divided.
Virtual Machine Architecture
It pretends some functionality, which is not native
to the hardware and/or software on which it is
implemented.
Is built upon an existing system and provides a
virtual abstraction, a set of attributes, and
operations.
The master uses the ‘same’ subservice’ from the
slave and performs functions such as split work, call
slaves, and combine results.
It allows developers to simulate and test platforms.
The main objective is to provide portability..
The hypervisor, also called the virtual machine
33
monitor, runs on the host OS and allocates matched
Cont…

34
Cont…
Applicable domain of virtual machine architecture:
It is suitable for solving a problem by simulation or
translation if there is no direct solution.
Sample applications include interpreters of
microprogramming, XML processing, script command
language execution, rule-based system execution,
Smalltalk and Java interpreter type programming
languages.
Benefits:
Portability and machine platform independency
Simplicity of software development

35
Simulation for disaster working model
Cont…
Limitations:
Slow execution of the interpreter due to the
interpreter nature
Additional overhead due to the new layer
Related architecture:
Interpreter, repository, and layered architecture

36
Layered Style
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, in a deployed component.
Each layer provides service to the layer above it and
serves as a client to the layer
A request from a higher layer to the layer below is
made via method invocation and the response goes back
up via the method return.
The higher layer provides more generic or application
oriented services, which are more abstract.
The lower layer provides more specific utility type
37
services, which are less abstract, and common services
which many upper layer components may need.
Class diagram for layered style

38
Cont..
Applicable domains of layered architecture:
Any system that can be divided between the
application-specific portions and platform-specific
portions which provide generic services to the
application of the system.
Applications that have clean divisions between core
services, critical services, user interface services, etc.
Applications that have a number of classes that are
closely related to each other so that they can be
grouped together into a package to provide the
services to others.
Related architecture:
39 Virtual machine, repository, and client-server
Cont…
Benefits:
Enhanced independence of upper layer to lower layer
since there is no impact from the changes of lower
layer services as long as their interfaces remain
unchanged.
Enhanced flexibility: interchangeability and
reusability are enhanced due to the separation of the
standard interface and its implementation.
Component-based technology is a suitable technology
to implement layered architecture; this makes it much
easier for the system to allow for plug-and-play of
new components.
40
Promotion of portability: each layer can be an abstract
Cont…
Limitations:
Lower runtime performance since a client's request
or a response to a client must go through
potentially several layers.
Many applications cannot fit this architecture
design.
Breach of interlayer communication may cause
deadlocks, and “bridging” may cause tight
coupling.
Exceptions and error handling are issues in the
41
layered architecture, since faults in one layer must
propagate upward to all calling layers.
Interaction-oriented architecture
The primary objective is to separate the interaction of user
from data abstraction and business data processing.
It decomposes the system into three major partitions −
Data module − Data module provides the data abstraction
and all business logic.
Control module − Control module identifies the flow of
control and system configuration actions.
View presentation module − View presentation module
is responsible for visual or audio presentation of data
output and it also provides an interface for user input.
Interaction-oriented architecture has two major styles
Model-View-Controller (MVC)
Presentation-Abstraction-Control (PAC).
42
MVC architecture
It is widely adopted for web application design
It is specifically used in applications where user interfaces
are prone to data changes.
It also typically supports “look and feel” features in GUI
systems.
Models: It manages the data, logic, and constraints of an
application. It consists of data components, which maintain
the raw application data and application logic for interface.
Views: it deal with everything graphical, they request data
from their model and display the data.
Controllers: it accepts an input and converts it to
43 commands for the model or view. It consists of input
MVC architecture

44
MVC - I
It is a simple version of MVC architecture where the
system is divided into two sub-systems −
The Controller-View − The controller-view acts as
input /output interface and processing is done.
The Model − The model provides all the data and
domain services.

45
MVC - II
MVC–II is an enhancement of MVC-I architecture in
which the view module and the controller module are
separate.
The model module plays an active role as in MVC-I
by providing all the core functionality and data
supported by database.
The view module presents data while controller
module accepts input request, validates input data,
initiates the model, the view, their connection, and also
dispatches the task.

46
Cont…
Applicable domains of MVC architecture
Interactive applications where multiple views are
needed for a single data model and the interfaces
are prone to frequent data changes.
Applications with clear divisions between
controller, view, and data modules so that different
professionals can be assigned to work on different
aspects of such applications concurrently.

47
Cont…
Benefits:
Many MVC vendor framework toolkits are
available.
Multiple views synchronized with same data
model.
Easy to change or plug in new interface views,
allowing updating of interface views with new
technologies without overhauling the rest of the
system.
Very effective for developments if graphics,
48
programming, and database development
professionals are working in a team in a designed
Cont…
Limitations:
Not suitable for agent-oriented applications such
as interactive mobile and robotics applications.
Multiple pairs of controllers and views based on
the same data model make any data model change
expensive.
The division between the View and the Controller
is not clear in some cases.
Related architecture:
PAC, and implicit invocation such as event-based,
49 multi-tier architecture
Presentation-Abstraction-Control
(PAC)
In PAC, the system is arranged into a hierarchy of
many cooperating agents .
It was developed from MVC to support the application
requirement of multiple agents in addition to
interactive requirements.
Each agent has three components −
The presentation component − Formats the visual
and audio presentation of data.
The abstraction component − Retrieves and
processes the data.
The control component − Handles the task such as
50 the flow of control and communication between the
How does it work?
The parent Control creates its child PAC elements,
either at program startup, or dynamically at run-time.
When the control of a PAC element receives a (user)
event (1)it may update its Presentation (2a) and/or its
Abstraction (2b).
Then it sends a change event to its parent (3).
The parent updates its children (but not the child
where the change originated) (5), which all update
their Presentation (6a) and/or Abstraction (6b).
After the children have been updated, the parent is
updated (7).
This ends when all necessary PAC elements have
51
been updated.
Cont…

52
Cont…
Applicable domains of the PAC architecture:
Suitable for an interactive system where the system can
be divided into many cooperating agents in a
hierarchical manner and each agent has its own specific
assigned job.
Suitable when the coupling among the agents is
expected to be loose so that changes on an agent do not
affect others.
Benefits :
Support of multitasking and multi viewing
Support agent reusability and extensibility
Easy to plug in new agent or replace an existing one
53

Cont…
Limitations:
Extra time lost due to the control bridge between
presentation and abstraction and the communication
of controls among agents.
Difficult to determine the correct number of the
agents due to the loose coupling and high
independence between agents.
Complete separation of presentation and abstraction
by control in each agent generates development
complexity since communications between agents
only take place between the controls of agents.
Related architecture:
54
Layered, multi-tier, and MVC
Distributed architecture
Components can cooperate with one another over a
communication network.
Information processing is not confined to a single
machine rather it is distributed over several independent
computers.
A distributed system can be demonstrated by the client-
server architecture which forms the base for multi-tier
architectures
Alternatives are the broker architecture such as CORBA,
and the Service-Oriented Architecture (SOA).
There are several technology frameworks to support
55 distributed architectures, including .NET, J2EE,
Cont..

56
Client-Server Architecture
It is the most common distributed system architecture
which decomposes the system into two major
subsystems or logical processes −
Client − This is the first process that issues a request
to the second process i.e. the server.
Server − This is the second process that receives the
request, carries it out, and sends a reply to the client.
The application is modeled as a set of services that are
provided by servers and a set of clients that use these
services.
The servers need not know about clients, but the
clients must know the identity of servers
57
Cont…

58
Advantages

Separation of responsibilities such as user


interface presentation and business logic
processing.
Reusability of server components and potential for
concurrency
Simplifies the design and the development of
distributed applications
It makes it easy to migrate or integrate existing
applications into a distributed environment.
It also makes effective use of resources when a
59
large number of clients are accessing a high-
performance server.
Cont…
Disadvantages
Lack of heterogeneous infrastructure to deal with
the requirement changes.
Security complications.
Limited server availability and reliability.
Limited testability and scalability.
Fat clients with presentation and business logic
together.

60
Multi-Tier Architecture (n-tier
Architecture)
It is a client–server architecture in which the
functions such as presentation, application
processing, and data management are physically
separated.
By separating an application into tiers, developers
obtain the option of changing or adding a specific
layer, instead of reworking the entire application.
It provides a model by which developers can create
flexible and reusable applications.
A three-tier architecture is typically composed of a
presentation tier, an application tier, and a data
61
storage tier and may execute on a separate processor.
Three-tier architecture
Presentation Tier
It is the topmost level of the application by which users can
access directly such as webpage
It translate the tasks and results to something that user can
understand.
Application Tier (Business Logic, Logic Tier, or Middle
Tier)
It coordinates the application, processes the commands,
makes logical decisions, evaluation, and performs
calculations.
Data Tier
The information is stored and retrieved from the database

62
or file system.
The information is then passed back for processing and
Cont…

63
Broker Architectural Style
It is a middleware architecture used in distributed
computing to coordinate and enable the communication
between registered servers and clients.
Object communication takes place through a middleware
system called an object request broker (software bus).
Client and the server do not interact with each other
directly.
Client and server have a direct connection to its proxy
which communicates with the mediator-broker.
A server provides services by registering and publishing
their interfaces with the broker and clients can request
the services from the broker statically or dynamically by
look-up.
64
CORBA (Common Object Request Broker Architecture)
Cont…

65
Service-Oriented Architecture
(SOA)
A service is a component of business functionality
that is well-defined, self-contained, independent,
published, and available to be used via a standard
programming interface.
The connections between services are conducted by
common and universal message-oriented protocols
such as the SOAP Web service protocol, which can
deliver requests and responses between services
loosely.
Service-oriented architecture is a client/server design
which support business-driven IT approach in which
an application consists of software services and
66
software service consumers (also known as clients or
service requesters).
Cont…

67
Features of SOA
A service-oriented architecture provides the following
features
Distributed Deployment − Expose enterprise data
and business logic as loosely coupled, discoverable,
structured, standard-based, stateless units of
functionality called services.
Composability − Assemble new processes from
existing services that are exposed at a desired
granularity through well defined, published, and
standard complaint interfaces.
Interoperability − Share capabilities and reuse shared
services across a network irrespective of underlying
68 protocols or implementation technology.
Component-based architecture
It is an extension of object-oriented architecture
It focuses on the decomposition of the design into
individual functional or logical components
It provides a higher level of abstraction and divides the
problem into sub-problems.
The primary objective is to ensure component
reusability.
A component encapsulates functionality and behaviors
of a software element into a reusable and self-
deployable binary unit.
There are many standard component frameworks such

69
as COM/DCOM, JavaBean, EJB, CORBA, .NET, web
services, and grid services.
What is a Component?
A component is a modular, portable, replaceable, and
reusable set of well-defined functionality that
encapsulates its implementation and exporting it as a
higher-level interface.
A component is a software object, intended to interact
with other components, encapsulating certain
functionality or a set of functionalities.
It has an obviously defined interface and conforms to
a recommended behavior common to all components
within an architecture.
A software component can be defined as a unit of
composition with a contractually specified interface
70 and explicit context dependencies only.
Views of a Component
A component can have three different views
Object-oriented view
A component is viewed as a set of one or more
cooperating classes.
It also involves defining the interfaces that enable
classes to communicate and cooperate.
Conventional view
It is viewed as a functional element or a module of a
program that integrates the processing logic, the internal
data structures
Process-related view
In this view, instead of creating each component from
71
scratch, the system is building from existing
Cont…

72
Characteristics of Components
Reusability − Components are usually designed to
be reused
Replaceable − Components may be freely
substituted with other similar components.
Not context specific − Components are designed to
operate in different environments and contexts.
Extensible − A component can be extended from
existing components
Encapsulated − A component do not expose details
of the internal processes or any internal variables or
state.
Independent − Components are designed to have
73
minimal dependencies on other components.
Cont…
Applicable domains of component-based
architecture:
Applications where the interface contracts between
subsystems are clear
Applications that require loose coupling between
the components and where many reusable
components are available
Suitable for the class library system organization
(.NET class library and Java API are built in
component architecture)

74
Cont…
Benefits:
Reusability of components.
System maintenance and evolution; easy to change
and update the implementation without affecting the
rest of the system.
Independency and flexible connectivity of
components.
Independent development of components by
different groups in parallel.
Productivity for the current and future software
development.
Many OO design tools can also be used for
75
component-based software development.
Cont…
Limitations:
It can be difficult to find suitable available
components to reuse.
Adaptation of components is an issue.
Few component-oriented dedicated design tools
are available.
Related architecture:
OO architecture, distributed architecture, SOA

76
Thank You!

You might also like