architectural styles class 1

24
Architectural Styles Dr Reeja S R Professor CSE Dept. SJEC Vamanjoor, Mangalore

Upload: dr-reeja-s-r

Post on 16-Feb-2017

112 views

Category:

Education


0 download

TRANSCRIPT

Page 1: Architectural  styles class 1

Architectural Styles

Dr Reeja S RProfessorCSE Dept.SJEC Vamanjoor, Mangalore

Page 2: Architectural  styles class 1

Architectural styles Recognize common

patterns build new systems as

variation on old systems

Selecting the right architecture

crucial to success

Page 3: Architectural  styles class 1

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

Page 4: Architectural  styles class 1

Pipes and Filters For Stream processing

Source

FilterFilter

FilterFilter Filter

Filter

Page 5: Architectural  styles class 1

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

linked to the input of another program.

Compilers.

Page 6: Architectural  styles class 1

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

Page 7: Architectural  styles class 1

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

Page 8: Architectural  styles class 1

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

Page 9: Architectural  styles class 1

Pipes and Filters Advantages:

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

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

Page 10: Architectural  styles class 1

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

Page 11: Architectural  styles class 1

DATA ABSTRACTION

Architectural style

Page 12: Architectural  styles class 1
Page 13: Architectural  styles class 1

Data Abstraction Components – objects

(discrete, independent, loosely coupled)

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

Page 14: Architectural  styles class 1

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

Page 15: Architectural  styles class 1

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

Page 16: Architectural  styles class 1

EVENT-BASED, IMPLICIT INVOCATION

Page 17: Architectural  styles class 1

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.

Page 18: Architectural  styles class 1

Debugger

Page 19: Architectural  styles class 1

Debugger

Components: ○ Debugger, TextEditor, VariableMonitor,

OutputWindow, etc

Page 20: Architectural  styles class 1

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.

Page 21: Architectural  styles class 1

Ex 2:

Page 22: Architectural  styles class 1

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

Page 23: Architectural  styles class 1

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

Page 24: Architectural  styles class 1

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