architectural styles class 1

Post on 16-Feb-2017

109 Views

Category:

Education

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Architectural Styles

Dr Reeja S RProfessorCSE Dept.SJEC Vamanjoor, Mangalore

Architectural styles Recognize common

patterns build new systems as

variation on old systems

Selecting the right architecture

crucial to success

Architectural styles Pipes and Filters Data abstractions Layered system Implicit invocation Repositories

Pipes and Filters For Stream processing

Source

FilterFilter

FilterFilter Filter

Filter

Pipes and Filters Examples:• Unix programs. The output of one program can be

linked to the input of another program.

Compilers.

Variants

Pipelines restricted to linear topology

Bounded pipes restricts the amount of data on a pipe

Typed pipes data on a pipe to be of an acceptable type

Pipes and Filters

Pipes and Filters Advantages:

○ Better understanding of global systemTotal behavior = sum of each filter behavior

○ Evolution and extensibility

Read numbers from File

Binary Search

Search Key

File Name No. list

Pipes and Filters Advantages:

○ Better understanding of global systemTotal behavior = sum of each filter behavior

○ Evolution and extensibility

Read numbers from File

Binary Search

Sort Numbers

Search Key

File Name

Pipes and Filters Advantages:

○ Better understanding of global systemTotal behavior = sum of each filter behavior

○ Evolution and extensibility○ Reusability○ Naturally support concurrency and parallelism

Pipes and Filters Drawbacks:

○ Possible delays in case of long pipelines

○ Non-Interactivity – A filter cannot interact with its environment

○ Adjacent filters are forced to agree upon a data format

DATA ABSTRACTION

Architectural style

Data Abstraction Components – objects

(discrete, independent, loosely coupled)

Connectors – Inter-object communication• Message passing, method invocation

Data Abstraction Advantages:

Changes are confined to one object

Decomposition○ large system into a set of interacting objects○ easy to manage & evolve

Highly Cohesive

Extensible○ via inheritance & polymorphism

Data Abstraction Drawbacks

● interaction == coupling• Need to know the identity of the object for communication

• indirect coupling:• A uses B, C uses B, then changes made by C on B are

unexpected to A

EVENT-BASED, IMPLICIT INVOCATION

Event Based Implicit invocation Instead of invoking a procedure directly, a component can

announce one or more events

Other components in the system can register an interest in

an event by associating a procedure to it.

When the event is announced, the system itself invokes all

of the procedure that have been registered for the event.

Thus an event announcement “implicitly” causes the

invocation of procedures in other modules.

Debugger

Debugger

Components: ○ Debugger, TextEditor, VariableMonitor,

OutputWindow, etc

Event Based Implicit invocation Instead of invoking a procedure directly, a component can

announce one or more events

Other components in the system can register an interest in

an event by associating a procedure to it.

When the event is announced, the system itself invokes all

of the procedure that have been registered for the event.

Thus an event announcement “implicitly” causes the

invocation of procedures in other modules.

Ex 2:

Event Based Implicit invocation Conditions (invariants) of this style are:

Announcers of events do not know which components will be

affected by those events

The order in which procedures are invoked is cannot be

determined

Event Based Implicit invocation Advantages:

It provides strong support for reuse - Any component can be

introduced into the system simply by registering it for the events

of that system

Implicit invocation eases system evolution - Components may be

replaced by other components without affecting the interfaces of

other components

Event Based Implicit invocation Dis Advantages:

Components surrender control over the computation performed

by the system.

Exchange of data – Sometimes data can be passed with an

event but at other times, systems must rely on shared repository

top related