Title: Architectural Styles 1
1Architectural Styles 1
Images below Homage to Magritte, in a way
- CSSE 377 Software Architecture and Design 2Steve
Chenoweth, Rose-Hulman InstituteWeek 3, Day 1,
March 23, 2009
And this is not a filter!
2Today
Right The real Magritte. What does This is
not a pipe mean, Rene?
- First biweekly quiz from Friday go over
- Architectural styles, Part 1 this
- Relates strongly to software reliability, and the
other QAs - Well talk about these thru slide 28 today.
- More details read the article case studies!
- Tonight turn in your teams case study choices
(see details, HW 9) - Project 2
- Progress reports Well discuss in class the
issues youve come up with, trying to test your
systems availability over the weekend. - Time to work on Project 2 in class
- Tuesday, 3/24, 1155 PM File a spreadsheet
showing the availability of the part of the
system you stressed, and how much you predict you
can improve it. Also turn in your journal with a
discussion of that spreadsheet how you decided
on the numbers, especially. - Policy clarification
- Late significant points off, unless previously
negotiated.
3Acknowledgements
- 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/p
roject/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/.
4What is an Architectural Style?
5What 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
6Questions 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?
7Todays styles (more tomorrow)
Garlan Shaws TOC
- Call and Return
- Data Abstraction
- Implicit Invocation
- Pipe and Filter
- Layered
- with examples!
(Slides 29)
8Call and Return
- Basically, this is application of a divide and
conquer systems theory. - Ill design and code Main and One, you want to
take Two and Three? Then well have another look
at Foo and Bar - Most common style?
- Fits with organizational considerations!
- Like calling a sequence of functions.
9Call 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
- Heuristic Try to follow an organized patter of
calling subroutines (like hierarchical).
10Call 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.
11Data Abstraction (Object Oriented)
12Data 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
13Data Abstraction Advantages
- May change representation without affecting
clients - Facilitates decomposition of problems
- Objects that mirror real-world entities will
evolve slowly
14Data 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
15Implicit Invocation (Callback)
Announcement of events
16Implicit 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
17Implicit Invocation Advantages
- Reuse any component can be introduced by
registering it for appropriate events - Evolution components may be replaced without
affecting other interfaces
18Implicit 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
19Implicit Invocation Example
- Publisher-Subscriber systems used for event
management, and more
Managed System
S1
P1
DB
Connection to Broker
Connection to Broker
Services Provided
Subscriptions
Web Client
Subscription Broker Architecture
S2
Subscription Distribution
Connection to Broker
Subscriptions
Managed System
Another System
P2
S3
Connection to Broker
Connection to Broker
Services Provided
Subscriptions
Ss subscribers to information. Ps
providers of information. Think RSS Feed, or
Object Request Brokers like CORBA.
20Pipe and Filter
21Pipe 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
22Pipe and Filter Examples
- Common Examples
- Unix shell scripts
- Compilers
- How you translate the data coming going from an
application (often using 3rd party products) - Specializations
- Pipelines linear structures
- Bounded pipes restrict amount of data
- Typed pipes data must be of certain type
23Pipe and Filter Advantages
- Behavior is just composition of filters
- Support reuse -- just reconnect
- Using standard I/Fs, 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). - Last year in 377, teams built pipe and filter
systems and had a speed contest.
24Pipe and Filter Disadvantages
- Often lead to batch processing
- 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 theres an error?
- Can you debug the problem?
- Can you backtrack for recovery?
25Layered
26Layered Properties
- Components often implement a virtual machine for
upper layers - Connectors defined by protocols between layers
- Quasi-invariant Layers often only interact with
neighbors
27Layered Advantages
- Abstraction separation of concerns
- Evolution changes to one layer only affect
neighboring layers - Reuse layers have strong interfaces
28Layered 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
29More Complex Examples
- ? See Garlan Shaws article (Case Studies) for
more info on each of these.
30KWIC Call and Return
31Key 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. Hes still around see
his profile at http//sigsoft.org/SEN/parna
s.html.
32KWIC 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
33KWIC Data Abstraction
34KWIC Implicit Invocation
35KWIC Pipe and Filter
36Oscilloscope
- Sample electrical signals
- Display pictures (traces)
- Perform measurements
37Oscilloscope Data Abstraction
38Oscilloscope Layered
39Oscilloscope Pipe and Filter
40Oscilloscope Modified Pipe and Filter