introduction to software engineering lecture 6 andré van der hoek
Post on 20-Dec-2015
222 views
TRANSCRIPT
Introduction to Software Engineering
Lecture 6
André van der Hoek
Today’s Lecture
Architecture design
Magic View
Requirements
Code
Professional View
Requirements
Code
ICS 52 Life CycleRequirements
phaseVerify
DesignphaseVerify
ImplementationphaseTest
TestingphaseVerify
Design
Architectural design High-level partitioning of a software system
into separate modules (components) Focus on the interactions among parts (connections)
Focus on structural properties (architecture) “How does it all fit together?”
Module design Detailed design of a component Focus on the internals of a component Focus on computational properties
“How does it work?”
Spotify Example
Architecturaldesign
Moduledesign
Provided Interface
Audio EncoderRequired Interface
Provided Interface
SelectorRequired Interface
Provided Interface
Audio PlayerRequired Interface
Com
pre
ssor
Provided Interface
Enco
der
Reader
Required Interface
Design Interaction
Architectural design(this lecture)
Module design(next lecture)
Architectural Design
Elements Floors Walls Rooms
Types Office building Villa Aircraft hanger
Styles Colonial Victorian Southwestern
Rules and regulations Electrical Structural
Elements Components Interfaces Connections
Types Office automation Game Space shuttle control
Styles Pipe and filter Layered Implicit invocation
Rules and regulations Use of interfaces Methods of change
Buildings
Software
Software Architecture: Essentials
Components What are the main parts? What aspects of the requirements do they
correspond to? Where did they come from? Examples: filters, databases, GUIs, interpreters
Connections How do components communicate? Examples: procedure calls, messages, pipes, event
broadcast Topology
How are the components and connections organized topologically?
Constraints (including constraints on change)
Comparison to Module Design
Architecture Modules• interactions among parts •
implementations of parts• structural properties • computational
properties• system-level performance • algorithmic
performance• outside module boundary • inside module
boundary
Where do Architectures and Components Come From?
Architectures: typically driven by kind of application Often possible to solve one problem many
different ways Components: many design strategies
ICS 52 component strategy: Component design by information hiding Designing systems for ease of extension and
contraction An OO design approach
Rationale: design systems that have a long, useful lifetime
We Can Do Anything…
Provided Interface
Big ComponentRequired Interface
Provided Interface
Tiny ComponentRequired Interface
Provided Interface
B ComponentRequired Interface
Provided Interface
Mr. ComponentRequired Interface
Provided Interface
A ComponentRequired Interface
Provided Interface
Yet ComponentRequired Interface
Provided Interface
Some ComponentRequired Interface
Provided Interface
One ComponentRequired Interface
Provided Interface
Mrs. ComponentRequired Interface
…But Style Has Proven to Help
Architectural styles restrict the way in which components can be connected Prescribe patterns of interaction Promote fundamental principles
Rigor, separation of concerns, anticipation of change, generality, incrementality
Low coupling High cohesion
Architectural styles are based on success stories Almost all compilers are build as “pipe-and-
filter” Almost all network protocols are build as
“layers”
Style 1: Hierarchy
Connections are function or method calls
Provided Interface
Main componentRequired Interface
Provided Interface
SubcomponentRequired Interface
Provided Interface
SubcomponentRequired Interface
Provided Interface
SubcomponentRequired Interface
Provided Interface
SubcomponentRequired Interface
Provided Interface
SubcomponentRequired Interface
Provided Interface
SubcomponentRequired Interface
Provided Interface
SubcomponentRequired Interface
Provided Interface
SubcomponentRequired Interface
Style 2: Client-Server
Connections are remote procedure calls or remote method invocations
Provided Interface
ClientRequired Interface
Provided Interface
ClientRequired Interface
Provided Interface
ClientRequired Interface
Provided Interface
ServerRequired Interface
Style 3: Blackboard
Provided Interface
Blackboard
Connections are encapsulated global variables
Provided Interface
One “Part”Required Interface
Provided Interface
My “Bit”Required Interface
Provided Interface
Her “Piece”Required Interface
Provided Interface
A “Part”Required Interface
Provided Interface
Another “Piece”Required Interface
Provided Interface
His “Bit”Required Interface
Style 4: Peer-to-Peer
Connections are remote procedure calls or remote method invocations
Provided Interface
PeerRequired Interface
Provided Interface
PeerRequired Interface
Provided Interface
PeerRequired Interface
Style 5: Pipe-and-Filter
Connections are pipes (also called data flows)
Pro
vid
ed
In
terf
ace
Filt
er
Req
uir
ed
In
terf
ace
Pro
vid
ed
In
terf
ace
Filt
er
Req
uir
ed
In
terf
ace
Pro
vid
ed
In
terf
ace
Filt
er
Req
uir
ed
In
terf
ace
Pro
vid
ed
In
terf
ace
Filt
er
Req
uir
ed
In
terf
ace
Style 6: Implicit Invocation
Connections are events on the software bus
Provided Interface
ComponentRequired Interface
Provided Interface
ComponentRequired Interface
Provided Interface
ComponentRequired Interface
Provided Interface
ComponentRequired Interface
Provided Interface
BusRequired Interface
Style 7: Layers (Take 1)
Connections are function or method calls + “something in between”
Provided Interface
Layer 4Required Interface
Provided Interface
Layer 3Required Interface
Provided Interface
Layer 2Required Interface
Provided Interface
Layer 1Required Interface
Provided Interface
Layer 4Required Interface
Provided Interface
Layer 3Required Interface
Provided Interface
Layer 2Required Interface
Provided Interface
Layer 1Required Interface
Style 7: Layers (Take 2)
Connections are function or method calls
extended
basic
corecore
Many Other (Variants of) Styles
Interpreters Batch sequential Data abstraction/OO systems Model View Controller (MVC) …
Different Styles, Different Situations
Layers Seven network layers in OSI reference
model Blackboard
Databases Inventory/stock management systems
Client-server Web browser/Web server
Peer-to-peer Distributed databases Communication satellites
Choosing the Right Style
Ask questions on whether a certain style makes sense The Internet as a blackboard
Does that scale? Stock exchange as a layers
How to deal with the continuous change? Math as hierarchy
How to properly call different modules for different functions?
Draw a picture of the major entities Look for the natural paradigm Look for what “feels right”
Mixing Styles Is Often Necessary
Blackboard + Client-Server
Provided Interface
BlackboardProvided Interface
One “Part”Required Interface
Provided Interface
My “Bit”Required Interface
Provided Interface
Her “Piece”Required Interface
Provided Interface
A “Part”Required Interface
Provided Interface
Another “Piece”Required Interface
Provided Interface
His “Bit”Required Interface
Provided Interface
BlackboardProvided Interface
One “Part”Required Interface
Provided Interface
My “Bit”Required Interface
Provided Interface
Her “Piece”Required Interface
Provided Interface
A “Part”Required Interface
Provided Interface
Another “Piece”Required Interface
Provided Interface
His “Bit”Required Interface
Original Blackboard
Mixing Styles is often Necessary
Blackboard + Implicit Invocation
Provided Interface
BlackboardProvided Interface
One “Part”Required Interface
Provided Interface
A “Piece”Required Interface
Provided Interface
Some “Bit”Required Interface
Provided Interface
BusRequired Interface
Mixing Styles Is Often Necessary
Pipe-and-Filter + Client-Server + Hierarchy
PipeFCalls
Provided Interface
Audio EncoderRequired Interface
Provided Interface
TunerRequired Interface
Provided Interface
Audio PlayerRequired Interface
Your Tasks
1. Read and study slides of this lecture
2. Memorize the architectural styles
3. Read and study Chapter 11 of van Vliet