+ All Categories
Home > Documents > Architectural Styles 1 - Rose–Hulman Institute of …...Architectural Styles 1 CSSE 574: Session...

Architectural Styles 1 - Rose–Hulman Institute of …...Architectural Styles 1 CSSE 574: Session...

Date post: 20-Aug-2020
Category:
Upload: others
View: 0 times
Download: 0 times
Share this document with a friend
40
Architectural Styles 1 CSSE 574: Session 8, Part 4 Steve Chenoweth Phone: Office (812) 877-8974, Cell (937) 657-3885 Email: [email protected] And this is not a filter! Images below Homage to Magritte, in a way…
Transcript
Page 1: Architectural Styles 1 - Rose–Hulman Institute of …...Architectural Styles 1 CSSE 574: Session 8, Part 4 Steve Chenoweth Phone: Office (812) 877-8974, Cell (937) 657-3885 Email:

Architectural Styles 1 CSSE 574: Session 8, Part 4

Steve Chenoweth

Phone: Office (812) 877-8974, Cell (937) 657-3885

Email: [email protected]

And this is not a filter!

Images below –

Homage to Magritte,

in a way…

Page 2: Architectural Styles 1 - Rose–Hulman Institute of …...Architectural Styles 1 CSSE 574: Session 8, Part 4 Steve Chenoweth Phone: Office (812) 877-8974, Cell (937) 657-3885 Email:

2

This Discussion

Architectural styles, Part 1 Relates strongly to software reliability/availability, and

the other QA’s

We’ll talk about these thru slide 28.

More details – read the article case studies (relate to the rest of the slides in this set)!

Right – The real Magritte.

What does “This is not a

pipe” mean, Rene?

Page 3: Architectural Styles 1 - Rose–Hulman Institute of …...Architectural Styles 1 CSSE 574: Session 8, Part 4 Steve Chenoweth Phone: Office (812) 877-8974, Cell (937) 657-3885 Email:

3

Acknowledgements

Some of the material in these slides is taken from “An Introduction to

Software Architecture” by Garlan and Shaw,

http://www.cs.cmu.edu/afs/cs/project/vit/ftp/pdf/intro_softarch.pdf.

David Garlan and Mary Shaw, from their home

pages http://www.cs.cmu.edu/~garlan/ and

http://spoke.compose.cs.cmu.edu/shaweb/.

Page 4: Architectural Styles 1 - Rose–Hulman Institute of …...Architectural Styles 1 CSSE 574: Session 8, Part 4 Steve Chenoweth Phone: Office (812) 877-8974, Cell (937) 657-3885 Email:

4

What is an Architectural Style?

Page 5: Architectural Styles 1 - Rose–Hulman Institute of …...Architectural Styles 1 CSSE 574: Session 8, Part 4 Steve Chenoweth Phone: Office (812) 877-8974, Cell (937) 657-3885 Email:

5

What is a Software Architectural Style?

Architectural Style =

Components + Connectors + Constraints

Primarily, the dynamics of the design

Components: computational elements

Connectors: interactions between

components

Constraints: how components and connectors

may be combined

Page 6: Architectural Styles 1 - Rose–Hulman Institute of …...Architectural Styles 1 CSSE 574: Session 8, Part 4 Steve Chenoweth Phone: Office (812) 877-8974, Cell (937) 657-3885 Email:

6

Questions About Architectural Styles

What is the design vocabulary?

What are the allowable patterns?

What is the underlying computational model?

What are the essential invariants?

What are common examples?

What are advantages and disadvantages?

What are common specializations?

Page 7: Architectural Styles 1 - Rose–Hulman Institute of …...Architectural Styles 1 CSSE 574: Session 8, Part 4 Steve Chenoweth Phone: Office (812) 877-8974, Cell (937) 657-3885 Email:

7

Styles covered in these slides

Call and Return

Data Abstraction

Implicit Invocation

Pipe and Filter

Layered

… with examples!

Garlan & Shaw’s TOC:

(Slides 29+)

Page 8: Architectural Styles 1 - Rose–Hulman Institute of …...Architectural Styles 1 CSSE 574: Session 8, Part 4 Steve Chenoweth Phone: Office (812) 877-8974, Cell (937) 657-3885 Email:

8

Call and Return

Main

One Two Three

Foo Bar

Basically, this is application of a “divide and conquer” systems theory.

“I’ll design and code Main and One, you want to take Two and Three? Then we’ll have another look at Foo and Bar…”

Most common style?

Fits with organizational considerations!

Like calling a sequence of functions.

Page 9: Architectural Styles 1 - Rose–Hulman Institute of …...Architectural Styles 1 CSSE 574: Session 8, Part 4 Steve Chenoweth Phone: Office (812) 877-8974, Cell (937) 657-3885 Email:

9

Call and Return Properties

Components are subroutines

Connectors are invocations

Heuristic: Cycles (recursion) are discouraged Clearest when subroutines (or whatever the boxes mean)

are called once to do “something”

Heuristic: Multitasking is discouraged Easier to follow “what happens next”

Usually synchronous “call and return” message style

Heuristic: Try to follow an organized pattern of calling subroutines (like hierarchical).

Invariants? Not a lot of guarantees about how data is manipulated as it moves through the system.

Note: “Invariants” = architectural principles that are true for this style,

especially in regard to maintaining integrity of data.

Page 10: Architectural Styles 1 - Rose–Hulman Institute of …...Architectural Styles 1 CSSE 574: Session 8, Part 4 Steve Chenoweth Phone: Office (812) 877-8974, Cell (937) 657-3885 Email:

10

Call and Return Example

Commonly seen as a way to organize large systems like this.

Gives a basic way to control coupling and cohesion.

Down in the details, usually you need layers or abstraction (OO) to keep complexity down.

Example is LDAP (Lightweight Directory Access Protocol) system, UC Berkeley. From

http://softwareengineeringnotes.blogspot.com/2007/07/call-and-return-architecture.html.

Page 11: Architectural Styles 1 - Rose–Hulman Institute of …...Architectural Styles 1 CSSE 574: Session 8, Part 4 Steve Chenoweth Phone: Office (812) 877-8974, Cell (937) 657-3885 Email:

11

Data Abstraction (Object Oriented)

Page 12: Architectural Styles 1 - Rose–Hulman Institute of …...Architectural Styles 1 CSSE 574: Session 8, Part 4 Steve Chenoweth Phone: Office (812) 877-8974, Cell (937) 657-3885 Email:

12

Data Abstraction

Properties

Components are objects - act as

managers of resources

Connectors are function invocations

Invariant 1: object maintains integrity of its

representation

Invariant 2: representation is hidden from

other objects

Page 13: Architectural Styles 1 - Rose–Hulman Institute of …...Architectural Styles 1 CSSE 574: Session 8, Part 4 Steve Chenoweth Phone: Office (812) 877-8974, Cell (937) 657-3885 Email:

13

Data Abstraction

Advantages

May change representation without

affecting clients

Facilitates decomposition of problems

Objects that mirror real-world entities will

evolve slowly

Page 14: Architectural Styles 1 - Rose–Hulman Institute of …...Architectural Styles 1 CSSE 574: Session 8, Part 4 Steve Chenoweth Phone: Office (812) 877-8974, Cell (937) 657-3885 Email:

14

Data Abstraction

Disadvantages

Must know identity of object in order to

interact with it

Our next style fixes that!

Side effects: changes caused by method

calls may propagate to clients

Example – a change in the number of

parameters you need to pass

Page 15: Architectural Styles 1 - Rose–Hulman Institute of …...Architectural Styles 1 CSSE 574: Session 8, Part 4 Steve Chenoweth Phone: Office (812) 877-8974, Cell (937) 657-3885 Email:

15

Implicit Invocation (Callback)

Event 1

Event 2

Event 3

...

Foo

Bar

Register interest in events

Notification of events

Announcement of events

Page 16: Architectural Styles 1 - Rose–Hulman Institute of …...Architectural Styles 1 CSSE 574: Session 8, Part 4 Steve Chenoweth Phone: Office (812) 877-8974, Cell (937) 657-3885 Email:

16

Implicit Invocation

Properties

Components are modules with:

procedures

events that are announced

events of interest

Invariant: announcers of events do not

know which components are registered

with those events

Page 17: Architectural Styles 1 - Rose–Hulman Institute of …...Architectural Styles 1 CSSE 574: Session 8, Part 4 Steve Chenoweth Phone: Office (812) 877-8974, Cell (937) 657-3885 Email:

17

Implicit Invocation

Advantages

Reuse: any component can be introduced

by registering it for appropriate events

Evolution: components may be replaced

without affecting other interfaces

Page 18: Architectural Styles 1 - Rose–Hulman Institute of …...Architectural Styles 1 CSSE 574: Session 8, Part 4 Steve Chenoweth Phone: Office (812) 877-8974, Cell (937) 657-3885 Email:

18

Implicit Invocation

Disadvantages

Control: no way to know what will happen

after event is announced

Data: may lead to performance problems

Correctness: meaning of procedure is

context dependent

Page 19: Architectural Styles 1 - Rose–Hulman Institute of …...Architectural Styles 1 CSSE 574: Session 8, Part 4 Steve Chenoweth Phone: Office (812) 877-8974, Cell (937) 657-3885 Email:

19

Implicit Invocation Example

Publisher-Subscriber systems – used for event management, and more:

DB

S’s = subscribers to information. P’s = providers of information.

Think RSS Feed, or Object Request Brokers like CORBA.

S1 P1

P2 S3

S2 Web

Client

Another

System

Managed

System

Managed

System

Connection

to Broker

Connection

to Broker

Connection

to Broker

Connection

to Broker

Connection

to Broker

Subscription

Dis

trib

ution

Subscription

Broker

Architecture

Services

Provided

Services

Provided

Subscriptions

Subscriptions

Subscriptions

Page 20: Architectural Styles 1 - Rose–Hulman Institute of …...Architectural Styles 1 CSSE 574: Session 8, Part 4 Steve Chenoweth Phone: Office (812) 877-8974, Cell (937) 657-3885 Email:

20

Pipe and Filter

Page 21: Architectural Styles 1 - Rose–Hulman Institute of …...Architectural Styles 1 CSSE 574: Session 8, Part 4 Steve Chenoweth Phone: Office (812) 877-8974, Cell (937) 657-3885 Email:

21

Pipe and Filter

Properties

Components apply local transformation to

their inputs - filters

Connectors act as conduits - pipes

Invariant 1: filters must be independent

Invariant 2: filters do not know their

neighbors

Page 22: Architectural Styles 1 - Rose–Hulman Institute of …...Architectural Styles 1 CSSE 574: Session 8, Part 4 Steve Chenoweth Phone: Office (812) 877-8974, Cell (937) 657-3885 Email:

22

Pipe and Filter

Examples Common Examples

Unix shell scripts

Compilers

How you translate the data coming & going from an application (often using 3rd party products)

Work flow manager – has a supervisory layer above the pipes and filters controls the flows of data

Specializations Pipelines: linear structures

Bounded pipes: restrict amount of data

Typed pipes: data must be of certain type

Page 23: Architectural Styles 1 - Rose–Hulman Institute of …...Architectural Styles 1 CSSE 574: Session 8, Part 4 Steve Chenoweth Phone: Office (812) 877-8974, Cell (937) 657-3885 Email:

23

Pipe and Filter

Advantages Behavior is just composition of filters

Support reuse -- just reconnect

Using standard I/F’s, can build out of off-the-shelf pieces

Easy to maintain and enhance

Permit analysis - throughput, deadlock

Support concurrency The filters can hand-off individual records, vs. whole files. Or better…

This is roughly how router connections on the Internet work, sometimes with only ~ 1-bit delays per box (like for ATM).

Two years ago in 377, teams built pipe and filter systems and had a speed contest. The winner converted a megabyte spreadsheet into XML in two seconds!.

Page 24: Architectural Styles 1 - Rose–Hulman Institute of …...Architectural Styles 1 CSSE 574: Session 8, Part 4 Steve Chenoweth Phone: Office (812) 877-8974, Cell (937) 657-3885 Email:

24

Pipe and Filter

Disadvantages Often lead to batch processing

What’s that? Programs in each stage run to completion before the next one starts.

Note that “batch” is legitimately how server maintenance is done – like backups and DB updating after hours, with checkpoints in the processes between steps

May be hard to coordinate streams

May force lowest common denominator for transmission

On one computer – a memory hog (how would you fix that?)

What do you do when there’s an error? Can you debug the problem?

Can you backtrack for recovery?

Page 25: Architectural Styles 1 - Rose–Hulman Institute of …...Architectural Styles 1 CSSE 574: Session 8, Part 4 Steve Chenoweth Phone: Office (812) 877-8974, Cell (937) 657-3885 Email:

25

Layered

U p

v C

Page 26: Architectural Styles 1 - Rose–Hulman Institute of …...Architectural Styles 1 CSSE 574: Session 8, Part 4 Steve Chenoweth Phone: Office (812) 877-8974, Cell (937) 657-3885 Email:

26

Layered Properties

Components often implement a virtual

machine for upper layers

Connectors defined by protocols between

layers

Quasi-invariant: Layers often only interact

with neighbors

Page 27: Architectural Styles 1 - Rose–Hulman Institute of …...Architectural Styles 1 CSSE 574: Session 8, Part 4 Steve Chenoweth Phone: Office (812) 877-8974, Cell (937) 657-3885 Email:

27

Layered Advantages

Abstraction: separation of concerns

Evolution: changes to one layer only affect

neighboring layers

Reuse: layers have strong interfaces

Page 28: Architectural Styles 1 - Rose–Hulman Institute of …...Architectural Styles 1 CSSE 574: Session 8, Part 4 Steve Chenoweth Phone: Office (812) 877-8974, Cell (937) 657-3885 Email:

28

Layered Disadvantages

Some systems are hard to partition this

way

Performance may require closer coupling

between upper and lower layers

Hard to find the right levels of abstraction

for all features

Page 29: Architectural Styles 1 - Rose–Hulman Institute of …...Architectural Styles 1 CSSE 574: Session 8, Part 4 Steve Chenoweth Phone: Office (812) 877-8974, Cell (937) 657-3885 Email:

More Complex

Examples…

See Garlan & Shaw’s

article (Case Studies) for

more info on each of these.

Backup Slides

Page 30: Architectural Styles 1 - Rose–Hulman Institute of …...Architectural Styles 1 CSSE 574: Session 8, Part 4 Steve Chenoweth Phone: Office (812) 877-8974, Cell (937) 657-3885 Email:

30

KWIC – Call and Return

Page 31: Architectural Styles 1 - Rose–Hulman Institute of …...Architectural Styles 1 CSSE 574: Session 8, Part 4 Steve Chenoweth Phone: Office (812) 877-8974, Cell (937) 657-3885 Email:

31

Key Word in Context (KWIC)

The KWIC index system accepts an ordered set of

lines, each line is an ordered set of words, and

each word is an ordered set of characters. Any line

may be "circularly shifted'' by repeatedly removing

the first word and appending it at the end of the

line. The KWIC index system outputs a

listing of all circular shifts of all lines in

alphabetical order.

-- David Parnas, 1972. He’s still around – see

his profile at http://sigsoft.org/SEN/parnas.html.

Page 32: Architectural Styles 1 - Rose–Hulman Institute of …...Architectural Styles 1 CSSE 574: Session 8, Part 4 Steve Chenoweth Phone: Office (812) 877-8974, Cell (937) 657-3885 Email:

32

KWIC Example

Input: descent of man

the ascent of man

the old man and the sea

Output: the ASCENT of man

DESCENT of man

descent of MAN

the ascent of MAN

the old MAN and the sea

the OLD man and the sea

the old man and the SEA

Page 33: Architectural Styles 1 - Rose–Hulman Institute of …...Architectural Styles 1 CSSE 574: Session 8, Part 4 Steve Chenoweth Phone: Office (812) 877-8974, Cell (937) 657-3885 Email:

33

KWIC – Data Abstraction

Page 34: Architectural Styles 1 - Rose–Hulman Institute of …...Architectural Styles 1 CSSE 574: Session 8, Part 4 Steve Chenoweth Phone: Office (812) 877-8974, Cell (937) 657-3885 Email:

34

KWIC – Implicit Invocation

Page 35: Architectural Styles 1 - Rose–Hulman Institute of …...Architectural Styles 1 CSSE 574: Session 8, Part 4 Steve Chenoweth Phone: Office (812) 877-8974, Cell (937) 657-3885 Email:

35

KWIC – Pipe and Filter

Page 36: Architectural Styles 1 - Rose–Hulman Institute of …...Architectural Styles 1 CSSE 574: Session 8, Part 4 Steve Chenoweth Phone: Office (812) 877-8974, Cell (937) 657-3885 Email:

36

Oscilloscope

Sample electrical

signals

Display pictures

(traces)

Perform

measurements

Page 37: Architectural Styles 1 - Rose–Hulman Institute of …...Architectural Styles 1 CSSE 574: Session 8, Part 4 Steve Chenoweth Phone: Office (812) 877-8974, Cell (937) 657-3885 Email:

37

Oscilloscope – Data Abstraction

Page 38: Architectural Styles 1 - Rose–Hulman Institute of …...Architectural Styles 1 CSSE 574: Session 8, Part 4 Steve Chenoweth Phone: Office (812) 877-8974, Cell (937) 657-3885 Email:

38

Oscilloscope – Layered

Page 39: Architectural Styles 1 - Rose–Hulman Institute of …...Architectural Styles 1 CSSE 574: Session 8, Part 4 Steve Chenoweth Phone: Office (812) 877-8974, Cell (937) 657-3885 Email:

39

Oscilloscope – Pipe and Filter

Page 40: Architectural Styles 1 - Rose–Hulman Institute of …...Architectural Styles 1 CSSE 574: Session 8, Part 4 Steve Chenoweth Phone: Office (812) 877-8974, Cell (937) 657-3885 Email:

40

Oscilloscope – Modified Pipe and Filter


Recommended