Title: Architectural Styles 2
1Architectural Styles 2
- CSSE 377 Software Architecture and Design 2Steve
Chenoweth, Rose-Hulman InstituteWeek 2, Day 4,
Thursday, Sep 16, 2011
Left Model for the repository style of
architecture is a warehouse. Half the battle is
designing it so that the same lift truck can
access anything you might need. The other half,
perhaps, is knowing where that is! Fisheye image
from www.moodleman.net/archives/202 .
2Today
- HW 2 Tim will post HW comments in Angel
dropbox. - More on arch styles this
- Bonus a few examples of possible questions on
the next biweekly quiz! - Project 2
- Time to work on Project 2 in class
- 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.
3Acknowledgements
- Some of the material in these slides is taken
from An Introduction to Software Architecture
by Garlan and Shaw.
4Arch styles, continuing
Garlan Shaws TOC
- Quick review of yesterdays styles
- New styles for today
- Repository
- Interpreter
- Distributed Processes
- Domain Specific
- State Transition Systems
- and 1 more example
5Call and Return
Review from Yesterday
6Data Abstraction (Object Oriented)
Review from Yesterday
7Implicit Invocation (Callback)
Review from Yesterday
Announcement of events
- Example implicit invocation biweekly quiz
question - Why does filters not knowing their neighbors
imply easy evolution?
8Pipe and Filter
Review from Yesterday
- Example pipe-and-filter biweekly quiz questions
- What does often leads to batch processing mean?
- Suppose this whole system ran in one computer,
and passed large images from filter to filter for
processing. How would you modify its operation
to save memory?
9Layered
Review from Yesterday
- Example layered system biweekly quiz question
- Suppose you discover that the Useful system
level has to communicate directly with the core
level to handle errors. What would you need to
do to be sure doing this didnt mess up your
system design?
10Repositories (Database or Blackboard)
New!
11Repository Properties
Repositories
- Components
- Central data structure
- Independent computational elements
- Database input stream selects processes
- Blackboard State of central data structure
selects processes - Used for finding nondeterministic solutions
- Has knowledge base vs DB at its center
- Invariant decisions are based on data on the
shared blackboard
Todays quiz Q 1
12Repository Advantages/Disadvantages
Repositories
- Similar to Implicit Invocation style
- Knowledge sources dont know IDs, but
- Control is driven by the blackboard
- Context is important for reasoning
- Usually complex interpretation is the goal
13Repository A Blackboard Example
Repositories
- Hearsay II (in Garlan Shaws article)
- Speech recognition
- Input stream speech signal
- Blackboard hypotheses about what was being said
- Independent computing elements
opportunistically tried to reach higher level
conclusions like If these words say Welcome
to Terre Haute. then that could be a coherent
sentence.
Hearsay IIs blackboard architecture from
www.cs.cmu.edu/.../Soft_Arch/base.105.html .
14Additional uses for blackboards
Repositories
- Breaking complex cryptographic codes
- Sensory interpretation and analysis (such as
computer vision) - Command and Control Systems
- Surveillance Systems
- Workflow Processing
- Case-based reasoning
- Symbolic learning
- Data Fusion
15Interpreter
Interpreters
16Interpreter Properties
Interpreters
- Components
- Interpretation engine
- Memory containing pseudo-code
- Control state of interpretation engine
- Current state of program being simulated
- Connectors
- Closely bound, with direct procedure calls and
shared state. - Interpreter examples See PLC!
- Lisp and Scheme, etc.
- Invariant? Details of the data manipulation are
hidden by the high-level language.
Todays quiz Q 2
17Interpreters what you get
Interpreters
- Binary instructions for a virtual machine, often
called bytecode, as is done in Lua, Python, Ruby,
Smalltalk, and many other systems (the approach
was popularized in the 1970s by the UCSD P-system
and UCSD Pascal) - A tree-like representation of the original
program, such as an abstract-syntax tree, as is
done for many prototype or educational
interpreters - A tokenized representation of the source program,
similar to Tcl - The characters of the source program, as was done
in MINT and TRAC
18Interpreter Advantages/ Disadvantages
Interpreters
- Superb end-user programmability and
maintainability supports dynamically changing
capabilities. - Slower than raw code doing the same thing.
19Distributed Processes
Distributed Processes
- SAP, as an example
- Each server has a dispatcher and a number of
work processes - These vary, depending on resource needs
- E.g., one may have only dialog processes and
another may have just background processing.
20Distributed Processes
Distributed Processes
- Often described in terms of their topology
- ring
- star
- Sometimes described in terms of communication
protocols - client/server
- peer-to-peer
- Heartbeat
- Invariant? Physical isolation of functions goes
with separation of responsibilities
21Distributed ProcessesAdvantages/ Disadvantages
Distributed Processes
- Inherently flexible and reliable
- Can be slow instead of fast!
- Use data close to its source, or batch it
- Keep conversations short
- Maintenance of individual parts
- What happens when you change 1 interface?
- Reliability
- Minimize the number of transactions
22Distributed Process Example Client/Server
Distributed Processes
- Like Web browser connected to a server
- What are good bad features of that?
PC Client
Database Servers
Web Servers
Application Servers
Each doing individual tasks
PC Client
Runs major applications
Gets requested data
Hands out Web pages
A typical 4-tiered client-server system Clients
request services, Servers respond.
23Distributed Process Example Cloud
(peer-to-peer)
Distributed Processes
- Issues
- Achieving scalability via distribution
- Achieving availability via duplication
- Whats stateless vs stateful
From Building cloud-ready, multicore-friendly
applications, Part 1 Design principles, at
http//www.javaworld.com/javaworld/jw-03-2009/jw-0
3-multicore-and-cloud-ready-1.html?page4.
Todays quiz Q 3
24Domain-Specific Styles
Domain-Specific Arch
- The prototypical example of a refined style
transaction processing using a credit / debit
card
25Domain-Specific Styles
Domain-Specific Arch
- Specific to a family of systems -- a product line
- Some components are common, but may be
implemented in different ways - Connections between common components are
preserved across family
26Domain-Specific Example - Transaction processing
systems
Domain-Specific Arch
- Used in banking, retail, loading docks, etc.
- Domain idea is that some activity of real value
occurs and needs to be recorded. Usually, assets
change hands - You get money at a bank machine
- You buy an iTune for your iPod
- You checkout your groceries at Krogers
- 60 refrigerators get loaded onto your stores
truck at the manufacturers warehouse
Image from www.handiramp.com/dock_equipment.htm .
27Domain-Specific Example - Transaction processing
systems
Domain-Specific Arch
- What quality attributes are important?
- Performance usually impacts productivity or
customer patience. - Reliability different meaning. Want all
transactions to be atomic. - Usually are distributed systems, with parts owned
by different organizations. - Invariant Guaranteed completion or roll-back of
transactions
Famously, we want all the ACID properties in
transactions Atomicity, Consistency,
Isolation and Durability. See, e.g.,
http//en.wikipedia.org/wiki/ACID.
Todays quiz Q 4
28Domain-Specific Example - Transaction processing
systems
Domain-Specific Arch
- Example Buying groceries at Krogers
PIN Pad
Krogers Inventory system
POS Register
Store
Gets VISA data
Tracks item-level sales
Scanner
Records transaction
VISA
In-store processor
Scans groceries
Authorizes payment
Supplies item info to POS, Updates inventory
system
POS Point of Sale
Kroger image from compulsivec.wordpress.com/2007/0
3/ .
29State Transition Systems
State-Transition Sys
- Remember formal methods?
- Heres where a state diagram IS the design!
30State Transition Systems
State-Transition Sys
- Set of states as components
- Set of transitions between states, as connectors
- Often built on hardware events
- Good style for reactive systems
- Invariant The various states defined determine
what can be done there.
31State Transition System Example Process Control
State-Transition Sys
- Use feedback or feedforward to control a process
Diagram from http//en.wikipedia.org/wiki/Feedback
. Feedback image from http//ocw.mit.edu/OcwWeb/El
ectrical-Engineering-and-Computer-Science/6-302Fee
dback-SystemsFall2002/CourseHome/, an MIT open
course on feedback systems
Todays quiz Q 5
32Examples
- Again, taken from Garlan Shaws Case Studies
section.
33Compiler Pipe and Filter
- A first try at compiler architecture hand off
the data from one step to the next, in passes.
34Compiler Modified Pipe and Filter
- But the steps all use the common Symbol Table
built during compilation, so need to have that
large, shared area to update.
35Compiler Repository
- And more improvements occur when the steps can
interact, using rules to guide decisions - Like whether you are trying to make a single
block of object code out of one segment of source
code. - Which leads to more of a repository style
architecture.