categorization of software architectures dataflow architectures pipes and filters batch...

45
Categorization of Software Architectures Dataflow architectures Pipes and Filters Batch sequential Independent components Client-server systems Parallel communicating processes Virtual machines Interpreters Rule-based systems Repository architectures Databases Hypertext systems Blackboards 1

Upload: denis-hall

Post on 26-Dec-2015

232 views

Category:

Documents


0 download

TRANSCRIPT

Categorization of Software Architectures

Dataflow architectures Pipes and Filters Batch sequential

Independent components

Client-server systems Parallel communicating

processes Event systems Service-Oriented

Architecture (SOA)

Virtual machines Interpreters Rule-based systems

Repository architectures

Databases Hypertext systems Blackboards

Layered architectures1

Data Flow Architectures

Each processing unit of the Data Flow Diagram is designed INDEPENDENTLY of the others

Data arises from sources, such as the users and flows back to users or collapse such as account databases.

2

account #& deposit

balancequery

account #& deposit

account #

User

Makeinquiry

accountdatabase

deposittransaction

accountdata

Get deposit

Get inquiry

Validateinquiry

Do deposit

transaction

Create account

summary

Validatedeposit

errorerror

Printer

memberbanks

bank name

Display account

account #

accountdata

accountdisplay

Partial Data Flow Diagram for ATM Application

3

Pipe and Filter Architecture

Processing elements (filters) accept streams as input (sequences of a uniform data elements) at any time, and produce output streams

Each filter must be designed to be implemented of the other filters.

The advantage is modularity

Pipe and Filter Style

Advantages:

Simplicity – Allows designer to understand overall input/output behavior of a system in terms of individual filters.Maintenance and reuse

Concurrent Execution –Each filter can be implemented as a separate task and be executed in parallel with other filters.

Pipe and Filter Style

DisadvantagesInteractive transformations are difficult

Filters being independent entities designer has to think of each filter as providing a complete transformation of input data to output data.

No filter cooperation.Performance – may force a lowest common

denominator on data transmission -parse and unparse

Data Flow Architecture I: Pipe and Filter Architectures

filter

filter

filter

filter filter

filter

pipe

< stream

stream >

pipeIndependent entitiesDoes not share state with other filters.

Stateless data streamSource end feeds filter input and sink receives output.

Responsibilities and Collaborationsof Pipes and Filters

ResponsibilitiesA filter takes a message from its input, applies a

transformation, and sends the transformed message as

output.

A pipe transports messages between filters. (Sources and sinks are special filters without inputs or outputs.)CollaborationsA filter produces and consumes messages.A pipe connects the filter with the producer and the

consumer. A pipe transports and buffers messages

Example of Pipe & Filter Data Flow ArchitectureThe application maintains accounts as transactions arrives at random times from communication lines.The architecture includes a step for logging transactions in case of system failure .The processing elements wait until all of the input has arrived before processing

Bankdata record Logtransaction analyze

deposit

deposit data

withdraw

withdrawal

account data

bank address

transaction result

transaction result

transaction

account data

account data

Comm

account data

withdraw function’s input isAliBasHesapNo1234Miktar 34566TL or ,bank address is BankNumara234.

A character stream example

Printing Web servicewith Pipes and Filters Incoming messages are based on the XML

specificationEach agency has added proprietary extensionsto the standard transactions.A print request message specifies the type ofdocument to be generated ( HTML or PDF…)The request also includes policy data (clientinformation, endorsements,… ).The Web service processes the proprietaryextensions and adds the jurisdiction-specificinformation that should appear on the printeddocuments (local or regional requirements,…)The Web service then generates thedocuments in the requested format and returnsthem to the agency management system. These processing steps can be implementedas a single transformation within the Webservice. But this solution does not let reuse thetransformation in a different context. For new requirements, it is required to changeseveral components of the Web service.

Pipes and Filters provides an alternative for the printing Web service.

The solution involves three separate transformations.The transformations are implemented as filters that handle conversion, enrichment, rendering.

Data Flow Architecture II : Batch Sequential Data Flow Architecture

Manage bank funds available for mortgages & unsecured lending.

Collectmortgage funds

Accountbalances

Mortgagepool

Unsecuredpool

Architecture:

Collectunsecured funds

Requirement:

Bath Sequential Architecture

Processing elements are only given batches of data, the result is a batch sequential form of data flow.

Disadvantages of DFD is the fact that they don’t map cleanly to code, whether object oriented or not.

Independent Components Architecture

Independent components are operated in parallel and communicated with each other from time to time.

This can be found on the WWW, where millions of servers and browsers continuously in parallel and periodically communicate each other

Components are portions of software that do notchange and that do not require knowledge of the software using them.

Independent Component Examples

.NET assemblies and Java NetBeans are example component technologies

Eclipse is a development platform designed to accommodate plug-ins.These are independent components that can be

created by developers for various purposes, and added to the platform without affecting existing functionality

Independent Components I :Tiered and Client Server Architectures

The server component serves the needs of the client upon requests

Client server architectures have the advantage of low coupling between the components.

When more than one person performs implementation, developers’ packages are often related as client and server It is naturel to parcel out (tie up) a package of classes

to each developer and developers require the services of classes for which others are responsible

Independent Components I : (cont’d) Tiered and Client- Server Architectures

A server component acts more effectively when its interface is Narrow.Narrow means that the interface (a collection of

functions) contains only necessary parts , is collected in one place ,is clearly defined.

If a third tier lies between client and server, three-tiered architecture is constituted.

Client-Server ArchitectureThe computer runs software called the client and it

interacts with another software known as the server located at a remote computer.

The client is usually a browser such as Internet Explorer, Netscape Navigator or Mozilla.

Browsers interact with the server using a set of instructions called protocols. These protocols help in the accurate transfer of data through

requests from a browser and responses from the server. There are many protocols available on the Internet.

The World Wide Web, which is a part of the Internet, brings all these protocols.

We can use HTTP, FTP, Telnet, email etc. from one platform (web browser.)

Example I :Two –Tiered Client-Server Architecture

Static HTML pages

The client (browser) requests for an HTML file stored on the remote machine through the server software.

The server locates this file and passes it to the client. The client then displays this file on machine.

In this case, the HTML page is static. Static pages do not change until the developer modifies them.

Example II: CGI Scripts

The server has to do more work since CGI programs consume the server machine's processing power.

Suppose a searchable form on a web page that runs a CGI program and browser sends the request to the server.

The server checks the headers and locates the necessary CGI program and passes it the data from the request

The CGI program processes this data and returns the results to the server. The server then sends this formatted in HTML to the browser which in turn

displays the HTML page. Thus the CGI program generates a dynamic HTML page. The contents of the dynamic page depend on the query passed to the CGI program.

Example III: Client-Server Architecture -Server Side Scripting Technologies

This case also involves dynamic response generated by the use of server side technologies. There are many server side technologies

Active Server Pages (ASP): A Microsoft technology (the extension .asp). PHP: Hypertext Preprocessor (PHP): An open source technology. PHP (.php, .phtml or .php3 ) Java Server Pages: .jsp pages contain Java code. Server Side Includes (SSI): Involves the embedding of small code snippets inside the HTML page.(.shtml as its file extension).

Independent Components II:Parallel Communication Processes Architecture

Several processes or threads are executed at the same timeA process as the combination of parallel parts can simplify

the design (Disjkstra)An example of this is a simulation of bank customers

Traditionally, many much simulations were designed without parallelism by storing and handling the eventsHowever such design can sometimes be simplified , if the

movement of each customer is a separate process (a thread object in Java)

Such a parallel communicated process matches more closely to the activities that it simulates.

Platforms for Communicating ProcessorsPlatform 1 Platform 2 Platform 3

execution

comunication

Parallelprocessesmay runon a singleplatformor onseparateplatformsas in figure

Example I Parallel Communicating Processes Architecture

Manage ATM traffic.

Architecture beginning with first session:

Requirement:

deposit

create retrieve*

12

3

4

Customer_n :Customer:

session_m :Session

customer_n_checking:Account

deposit*5

(more work)

(thread detail omitted)*

Customer n creates session mSession m retrieves an Account objectcustomer n checking.The retrieval is performed asynchronously .A thread (parallel process) is created

(1)An object for customer is created(2)Customer n creates session m .(3)Session m retrieves an Account object customer n checking

The retrieval is performed asynchronously . A thread (parallel process) is created because it may take time.This allows the customer to carry out other business in the same time.

(4)The customer object immediately performs a deposit transaction by sending a message to the Session object

(5) The session object executes the deposit transaction by sending a message to the session object, producing a new thread

Other work can go on while deposit is processed

Processing of the Parallel Architecture step by step

Example II: Parallel Communicating Processes Architecture Manage ATM traffic.

Architecture:

withdraw

deposit

create

create retrieve*

retrieve*

1

23

4

Customer_n :Customer:

customer s :Customer

session_k:Session

session_m :Session

customer_ s_saving : Account

customer_n_checking:Account

deposit*5

(thread detail omitted)*

withdraw*

26

Independent Components III:Event System Architectures and Design

Patterns

Many set of components are viewed . Each of them waits until an event occurs that

effect it.A word processor waits for the user to click on an

icon. It then reacts. Event systems are achieved as state

transaction systems .The state pattern solves the problem how to

use an object without having to know its state.

RolePlayingGame

State Design Pattern Applied to Game Encounter

RPGamehandleEvent()

GameStatehandleEvent()

state

{ state.handleEvent(); }

EncounterGame

State design pattern can be used to handle the states and actions of Encounter. The framework class RPGGame (role-playing game) has an attribute called state ,

which is of type GameState. The subtype of state (which class of GameState it belong to) determines what

happens when handleEvent() is called on an RPGameObject. The code for handleEvent() in RPGGame passes control to the handleEvent()

function of state.

Virtual Machine Architectures

Application 1

Interpreter

Program 1written in language

understoodby interpreter

Application 2

Interpreter

Program 2written in language

understoodby interpreter

Leveraging Interpreter to Facilitate Creation of Applications

Threats an application as a program written in a specific-purpose language.

Since an interpreter for such a language has to be built , this architecture is effective only if several programs are to be written in the language, generating several applications

Advantages: If the application consists of processing of complex entities, and if these entities (such as the orders in an example) are readily describable by a grammar.

Layered Architectures

An architectural layer is a coherent collection of software artifacts (like a package of classes)

A layer uses at most one other layer and is used by at most one other layer

Building application layer by layer can simplify the process

Some layers, such as frameworks can serve several applications.

Role-playing game layer

Layered Architecture

Characters LayoutRolePlayingGame

EncounterCharacters

EncounterEnvironment

Encounter Game

Application layer

3D engine layer

«uses»

«uses»

Framework Layer

Application LayerFramework Layer

Infrastructure LayerFrom http://www.openoffice.org/white_papers/tech_overview/tech_overview.html#3

Application Framework Library

SVX Library

Star

Offi

ce A

PI

Layered Architecture Example Using Aggregation

Architecture:

Class model:(relationships withinpackages not shown)

Ajax bank printing Layer

Accounts Layer Ajax bank common library Layer

Ajax bank printing

Printer PageFormatter

AjaxLogo AjaxDisclaimer Regulations

Accounts

Account Customer

Vendor-supplied Layer

Ajax bank common library

“uses”

Vendor-suppliedlayer not shown

Ajax common library contains classes throughout Ajax applications and adresses

Repository Architectures

An architecture built primary around data is called a repository architecture.

These systems are designed to perform transactions against a database For example , an electric company maintains a data

base customers that includes details about them. Other examples are IDEs (ınteractive development

Environment IDEs apply processes such as editing and

compiling to a database of source and object files.

A Typical Repository Architecture

Database

DBMS

GUI

Analysisprocess

1

Analysisprocess

n…...…...

Control

Key:Control flow:Data flow:

This figure mixes the data flow between entities and control .«Control «means that one of the entities prompts the operation of other (for example turns it on and off)

More Repository Architectures Blackboard architectures developed for artificial intelligence

applications are repositories that behave in accordance with posting rules

Hypertext architecture The most common use of hypertext is on the Web. An application that manages the artifacts of a software

engineering application The word repository used in industry to denote a

application that provides a unified view of a collection of databases (not just one) – Data Warehouses Repositories don’t change the structure of databases,

but they allow uniform access to them .

When is Repository Architecture Preferred?

Many applications make their databases their core, therefore repository architectures occupy significant part of applications.

When the processing is negligible compared to the formatting of data from the database, repository architectures are appropriate.

Bank Teller Analogy for Service-Orientation

Different types of tellers offer different services– Tellers specialized to perform only certain types of transactions (which are typically closely related) Example partitioning: •Account Management (Opening and closing accounts) Credits (inquiry about conditions, consulting, applying for mortgages) Cash Register (Withdrawals, deposits, funds transfers) Currency exchange (buy and sell foreign currencies) There may be several tellers offering the same set of services (forload balancing / failover) What happens behind the counter is not your business (bulletproofglass, iron bars) If you require a complex transaction, you may have to visit severaltellers (customer as transaction coordinator

Service (Definition)

A service is a package of closely related standardizedFunctionsThey are called repeatedly in a similar fashion, therefore it may be implemented by a dedicated facility,

which can be specialized to perform them.Example: Account Management– A service can be partitioned and have multipleservice functions.Example: Open new account– The smallest subunits within service functionsare called service primitives.Example: Generate next available account number

Characteristics to completely describe a service

Service requester (“client”) Who/which components use or need the service? For the service requester, the provided service is most important, andnot how it is implemented (principle of information and implementationhiding) Service provider (“server”)Who/which components implement or provide the service?is responsible for hosting the service, and ensuring the promised QoS may charge for service usage Qualities of Service (QoS)What are the parameters that allow to distinguish good service provisioning from bad? Examples: Reliable, predictable execution, cost, execution time, level ofprivacy, other guarantees

Interface

An interface constitutes the specification of a service, thatis implemented by a certain component. The interface defines a contract, to which the component thatimplements it has to comply. Signature of interfaces can be described using formal

languagesWeb Services Description Language (WSDL)OMG/ISO Interface Definition Language (IDL) (for CORBA)UML Object Constraint Language (OCL)But also: Java, C++ headers, . . .

Type-safe interfaces sometimes introduce tight couplingWeb Services don’t force you into type-safe interfaces

Different message types may be acceptable to a service

Software Architecture

Software architecture encompasses the set ofsignificant decisions about the organization of asoftware system

selection of the structural elements from which the systemis composed, and the interfaces to these

behavior as specified in collaborations among those elements

(de)composition of these structural and behavioralelements into a larger systemarchitectural style that guides this organization

Service-Oriented Architecture The architectural style of an application is called service-oriented if it

meets the following criteria: It is not monolithic; common blocks of functionality are brokenout of the applications and are instead provided by services

A significant part of the overall functionality is implemented by services,

which exist otherwise independent of the application Design elements for an SOA are:

Components: services (can be composites), consumers, providers Connector type: (remote) service invocations

Configuration rules for an SOA are: No strict layering (service implementations can use other services) No centralized control entity Services are designed for shared use, and for use that may not even

have been anticipated at design time

Service-Orientation Service-Orientation is an organizational principle– A set of principles for building large systems– It is not tied to any particular technology Examples: Common “horizontal” services: Logging, authentication/single-sign-on, systems management, Directory lookup of services, event notification “Vertical” services, specific to your business domain Product feature search service, Address management, Order Status Tracking Service, Truck/trailer tracking service As in organizations, there is always more than one way to structure a large

system The most important question: How to decompose? – What is the guiding abstraction mechanism? – Why would one favor one decomposition for another?