Lecture 14 - Ph.D Program @ GCCIS

jiggerbarnacleΚινητά – Ασύρματες Τεχνολογίες

24 Νοε 2013 (πριν από 3 χρόνια και 8 μήνες)

60 εμφανίσεις

Lecture 14

Software Architecture Case Studies

Design Patterns
-
Intro



The
Rest of the Quarter

10.24 Mon:
software architecture, design patterns


-

V
ictor (pattern methodology to specify usable security in websites)


10.26 Wed:
design patterns, reverse engineering




O
luyinka

(evolutionary patterns of design and design patterns)

-------------------

10.31 Mon:
reverse engineering




Michael (reverse engineering of design patterns from Java source code)


11.2 Wed:
model
-
based verification




Adrian (static code analysis: a road map)

-------------------

11.7 Mon:
model
-
based testing




S
owmya

( model based software testing)


11.9 Wed:
final review of the course

-------------------

11.14 Mon:
final exam week starts, work on your project


11.16 Wed:
final project presentation

1.
Data design:


data structure, data storage


s
imulation of data structures if needed


2.
Architecture structure


Context


Types of components and their operations: computational, memory,
manager, controller


Instantiation for the problem


3.
Architecture Styles: how to compose the components


4.
Architecture Assessment: reusability, testability








Review Lecture 13




Software Architecture Design Process


Software architecture case studies


Software architecture design tools (further
reading list)


Intro to Design Pattern


Break


Victor’s presentation







A Roadmap for Today

Architectural Styles and
Design: Case Studies


1.
Two small concrete examples

2.
Indusial system


Case Study 1
-

KWIC:
Key
Word in Context


Problem [Parnas72]: on the criteria to be used in
decomposing systems into modules


The
KWIC [Key Word in Context] 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.

KWIC
Index System


Input: strings, each of which consists of several words.


Clouds are white.


Ottawa is beautiful.



Output: a sorted list of all orderings of each input string.


are white Clouds


beautiful Ottawa is


Clouds are white


is beautiful Ottawa


Ottawa is beautiful


white Clouds are

Things to Consider when Design


Choices of data structure


Alternatives of algorithms


Performance


Reuse


Enhancement to system functions (interactive)


Architectural Design for the KWIC System

1
.
Main
-
program
-
with
-
subroutines
style

Main
-
program
-
with
-
subroutines style


Advantages


Efficient representation of data (since they are
shared)




Disadvantages



Changes to data format affects several modules.


Difficulty to implement changes/enhancements
in the overall processing algorithm.


Don't support reuse.

Architectural Design for the KWIC System

2
.
Abstract
-
data
-
type style

Abstract
-
data
-
type


Data is not shared anymore


encapsulated in objects



Advantages



Changes in algorithms and data representation in
individual components don't affect other components.


More reuse support.



Drawbacks



Changes in functionality can be difficult


might involve components modification or addition

More Comparison of the Two Designs


Efficiency:

1.
OO design


frequent transfer of the controls

2.
Shared memory


natural to the functionality



Independent

development:

1.
OO design



interfaces more high
-
level

abstract

2.
Shared memory


table structure as input output
between modules



Comprehensibility:


1.
OO design



small module, relatively independent
between modules

2.
Shared

memory
-

need to understand it as a whole

Architectural Design for the KWIC System

3
.
Implicit
-
invocation style

Implicit
-
invocation style


Calls to circular shift and alphabetizer are implicit, and
are the result of inserting lines



data driven



Data accessed abstractly

(compared to previous
approach, exposing storage formats)



Advantages


Supports functional enhancements.


Changes to data don't affect computation.



Drawbacks


Difficult to control processing order.


Tend to use more space than other solutions.




Architectural Design for the KWIC System

4
.
Pipes
-
and
-
filters style

Pipes
-
and
-
filters style


Advantages


Maintains intuitive flow of processing.


Supports reuse.


Supports addition of functionality.


Supports modifications.



Drawbacks


Virtually impossible to support an interactive system.


Inefficient use of space
-

each filter must copy all data to
its output.

Comparison of Architecture Styles

Case Study 2:
Mobile Robotics

Mobile Robotics System



controls manned, partially
-
manned,
or unmanned
vehicle
--
car, submarine,
space vehicle
, etc
.



System performs tasks that involve
planning and
dealing with obstacles and other
external factors
.



System has sensors and actuators and real
-
time

performance constraints.

Design Considerations


Req

1: System must provide
both
deliberative
and
reactive
behavior
.



Req

2: System must deal with
uncertainty
.



Req

3:
System must deal with
dangers
in robot’s
operation and environment
.



Req

4: System must be
flexible
with
respect to
experimentation and reconfiguration
of robot
and
modification of tasks.

Mobile Robots
--
Proposed
Architectures

• Control
loops

• L
ayered
organization


Task
-
control
architecture


Blackboard


AIS
Reference Architecture



layers



pipes and filters

Mobile Robots
--
Control
Loop Architecture

Analysis of the Model


Simple actions, no decomposition of the tasks



Changes in environment are continuous,
require continuous reactions



Reuse

Mobile Robots
--
Layered Architecture

Analysis of the Design


Define abstract layers





can manage uncertainty well


f
ault tolerance



simple dependencies, can be replaced



Service and request only can be passed between
adjacent components



Does not separate data hierarchy and control
hierarchy

Mobile Robots
--
Task
-
control

Architecture (Implicit Invocation)

Analysis of the Design


Exception handling routines, good for
handling spontaneous events



Separate action and reaction events are
separated, explicitly express concurrency



Safety: allow condition check at the wiretap

Mobile
Robotics

Blackboard Architecture

Analysis of the Design


CODGER system



Captain: overall supervisor



Map navigator: high level path planner



Lookout: monitors environment



Pilot: monitor control for paths



Perception subsystem: accept inputs from sensors


Analysis of the Design


Communicate via shared repository


database


Coordinate to resolve conflicts at the
database, handle uncertainty


Wiretap, exception and monitor are easy


Concurrency


Mobile Robotics
--
Summary of

Architectural Tradeoffs

Applied to large industrial applications

Mixed styles: dependent on the components



A
good software architecture case studies web:

http
://www.bredemeyer.com/ArchitectZone/Public
DomainArchitectures/PublicArchitectureIndex.htm


Android: Layered Architecture


Applications (Java): users, Google programmers



Application Framework: basic tools, reuse components,
e.g. locating your physical locations



Libraries (C/C++): interact with device drivers of media,
graphics…



Runtime: virtual machine for Java



Linux: networking, inter
-
process
-
communications

Mobile Computing: Android

Android GUI Architecture

Single
-
threaded, event driven


MVC pattern


Model: data or data
container


View: display


Controller: responds to
external actions




Phoenix

Infrastructure

.Net CodeGen

Runtime JITs

Pre
-
JIT

OO and .Net optimizations

Native CodeGen

Advanced C++/OO
Optimizations

FP optimizations

OpenMP, Concurrency

Retargetable

“Machine Models”

~3 months:
-
Od

~3 months:
-
O2

Chip Vendor CDK

~6 month ports

Sample port + docs

Key ports still done at msft

Academic RDK

Full sources (future)

Managed API’s

IP as DLLs

Docs

MSR & Partner Tools

Built on Phoenix Managed API’s

Both HL and LL API’s

Program Analysis

Program Rewrite

MSR Adv Lang

Language Research

Direct xfer to Phoenix

Research Insulated from
code generation


Analysis & Profiling

Static Analysis Tools

Profilers

Defect Detection




Delphi

Cobol

HL Opts

LL Opts

Code Gen

HL Opts

LL Opts

LL Opts

HL Opts

Native

Image

C#

Phoenix Core



IR Syms Types FlowGraph RegionGraph Expressions SSA Simulation

Dataflow Alias EH Readers Writers

Basic Utilities


Xlator

Formatter

Browser

Phoenix Managed APIs

Profiler

Obfuscator

Visualiz
er

Security

Checker

Refactor

Lint

VB

C++ IL

.NET

assembly

C++

C++AST

PreFast

Profile

Eiffel

C++

Phx AST

Lex/Yacc

Tiger

Code Gen


Further reading:

Software Architecture Design Tools


Unicon
: architecture description language,

http
://www.cs.cmu.edu/~UniCon
/




Aesop
:
a
generic toolkit
for customizing
with
architectural style

descriptions

http
://www.cs.cmu.edu/~
able/aesop/aesop_home.html



Wright
: architecture description language

http://www.cs.cmu.edu/~able/wright
/


To do

-

Reading assignment
: evolutionary patterns of
design and design
patterns (10.26/wed in class)


Wild & Crazy Ideas




Modeling beyond Software, Lessons we could learn for software modeling

Modeling Social Behavior:

Circle of Trust





Superconductor:


http
://blogs.scientificamerican.co
m/psi
-
vid/2011/10/19/quantum
-
levitation
-
where
-
science
-
videos
-
dont
-
get
-
any
-
cooler
/