View - CSE Labs User Home Pages

gayheadtibburInternet και Εφαρμογές Web

5 Φεβ 2013 (πριν από 4 χρόνια και 2 μήνες)

127 εμφανίσεις

SEng

5861: Software Architecture


Lecture 9

Dr. Michael Whalen

Fall 2010

10/14/2010

1

SEng 5861
-

Mike Whalen

Topics for Today


Questions / Comments from Last Week


Project Phase III Questions / Examples


Architectural Patterns & Pattern
Languages


Guest Lecture: Software Product Line
Engineering


10/14/2010

2

SEng 5861
-

Mike Whalen

Project Phase III

1.

Version History

2.

Table of Contents

3.

Introduction

4.1

Purpose and Scope


4.2

Audience

4.3

Status


4.4

Architectural Design Approach

5.

Glossary


6.

System Context


6.1

System Environment


6.2

Overview of Requirements

6.3

System Scenarios


7.

Architectural Forces

7.1

Goals

7.2

Constraints

7.3

Architectural Principles

8.

Architectural Views for Top
-
Level
System


Pick Two views

9.

Architectural Views for
Subsystem


Pick Two Views


10.

Appendices

10.1

Appendix: Decisions and
Alternatives

10.3

Appendix: References


10/14/2010

SEng 5861
-

Mike Whalen

4

Do this

Refer to

Phase II

Do this

Refer to

Phase II

Do this


Do this

Optional

What do I do
HERE?

How do I bound my (sub)system?


Several questions about what to call a
subsystem and when is it architecturally
interesting?


To make it concrete, I’ll pick on
Ziad

a
little


10/14/2010

SEng 5861
-

Mike Whalen

5

Choosing a subsystem to analyze
for Android


The Android SDK
allows one to build
applications for the
Google Android
phone platform


It is all in Java, so the
SDK is a (large!) suite
of Java classes that act
as a framework for
Android applications

10/14/2010

SEng 5861
-

Mike Whalen

6

Choosing a subsystem to analyze
for Android


View

class is the base class for all GUI widgets


All controls, canvases, windows, etc. are derived from
View
.


Layout and composition is performed by
ViewGroup

subclass



Question 1: Do Android
Views
(the View class and its
descendents) form an architecturally interesting
subsystem to analyze?


Question 2: Is it enough to look at

the
View
class and its descendents?

10/14/2010

SEng 5861
-

Mike Whalen

7

Android
Views:
Interesting?


Q1: Yes.


Q2: No


The Android
view
architecture encompasses
more than just the subclasses of the
View
class


Layout can be externalized to XML resources


View class can also process UI
events
generated by
the
platform (i.e.
it also acts as
controller
)


Usually this event processing is performed by
event
listener
classes that attach to views


10/14/2010

SEng 5861
-

Mike Whalen

8

So which
parts
are interesting?


Do not describe all 50+ subclasses of
View



Interesting parts (to me) are:


Top
-
level interface for view objects and how this
allows a MVC
-
style architecture for the GUI


View compositing hierarchy


how are child views laid
out and composed?


View creation: either programmatic or via the XML
interface


Use of
event listeners

to specialize view event
processing

10/14/2010

SEng 5861
-

Mike Whalen

9

Which viewpoints are interesting?

10/14/2010

SEng 5861
-

Mike Whalen

10

Which viewpoints are interesting?


Well, certainly functional


Depending on XML creation interface,


Deployment:
The XML view descriptions are
stored as separate resource files that must be
bundled with the application. How does this
work?


Development:
describe the module structure
for views and their dependencies to other
portions of the Android API.


10/14/2010

SEng 5861
-

Mike Whalen

11

ARCHITECTURAL
PATTERNS

10/14/2010

SEng 5861
-

Mike Whalen

12

Architecture & Design Patterns


A
design pattern is
a
solution

to a
problem
that occurs repeatedly in a variety of
applications



Documents both how problem is solved and (to
some extent) why


Why is this idea problematic?


What is the rationale for the solution?



Solution (pattern) must be non
-
obvious

10/14/2010

SEng 5861
-

Mike Whalen

13

10/14/2010

SEng 5861
-

Mike Whalen

14

Architecture & Design Patterns


Each pattern has a name



Use of each pattern has documented
consequences


May be both positive and negative



When is a pattern “architectural”?


Short answer: it depends


Longer answer (in the form of a question): how
central is it to the architecture being described?

10/14/2010

SEng 5861
-

Mike Whalen

15

A Pattern Language


Describe a
system in terms
of interacting
patterns


Focus is on
describing
relationships
between
patterns

10/14/2010

SEng 5861
-

Mike Whalen

16

Patterns and Views

10/14/2010

SEng 5861
-

Mike Whalen

17

Example: Layers Pattern

10/14/2010

SEng 5861
-

Mike Whalen

18

Pattern: Layers

Consider a system in which high
-
level components depend on low
-
level
components to perform their functionality, which further depend on even lower
-
level components and so on. Decoupling the components in a vertical manner is
crucial in order to support modifiability, portability, and reusability. On the other
hand components also require some horizontal structuring that is orthogonal to
their vertical subdivision.


To achieve these goals, the system is structured into layers so that each layer
provides a set of services to the layer above and uses the services of the layer
below. Within each layers all constituent components work at the same level of
abstraction and can interact through connectors. Between two adjacent layers a
clearly defined interface is provided. In the pure form of the pattern, layers
should not be by
-
passed: higher
-
level layers access lower
-
level layers only through
the layer beneath.

Layers


Examples:


Network stacks: OSI,
TCP/IP


OS Organization


Virtual Machines


Robotics


Planning Systems


Avionics


10/14/2010

SEng 5861
-

Mike Whalen

19

Indirection Layer


Provide
a unified interface to a set of interfaces
in a subsystem without damaging the
generic
form of the sub system.


Also called Façade pattern


Image from: http://www.renaissance.co.il/ivbug/meeting87/Architecture%20and%20design%20patterns.ppt

Data and Layer Patterns

10/14/2010

SEng 5861
-

Mike Whalen

21

22

Pipe and Filter Pattern

Target
Data

Transformation Program

Source Data









9/11/2010

SEng 5861
-

Mike Whalen

Data Repository

10/14/2010

SEng 5861
-

Mike Whalen

23

Can be passive or active;
passive repo stores data;
active repo broadcasts
changes in data to interested
clients (Pub / Sub)

Blackboard usage is for splitting
processing of complex problem
into subtasks that can be
simultaneously solved. A control
client monitors & coordinates the
blackboard

Coordinator

Adaptation Patterns

10/14/2010

SEng 5861
-

Mike Whalen

24

Language Interpretation
-
based patterns

Generic
Interface

Patterns

Deferred Binding Patterns

Microkernel

10/14/2010

SEng 5861
-

Mike Whalen

25

Microkernel Pattern

10/14/2010

SEng 5861
-

Mike Whalen

26

Mechanism implementing primitives

Resource Policies

Client Services

Microkernel Pattern

10/14/2010

SEng 5861
-

Mike Whalen

27

From: people.cs.uchicago.edu/~mark/51050/lectures/lecture.6/lecture.6.ps

Reflection


Reflection allows runtime discovery of
interfaces and dynamic calls to discovered
services.


Built into programming

languages


Java


Python


Ruby


Also built into

middleware


COM/DCOM


CORBA

10/14/2010

SEng 5861
-

Mike Whalen

28

Reflection & Modification


Some tools allow reflection interface to
modify
class
or even
language
definitions


Re
-
program system on
-
the
-
fly!


These are often called
Metaobject

protocols


Easy to create derivative languages using
this functionality

10/14/2010

SEng 5861
-

Mike Whalen

29

Interceptor Pattern

10/14/2010

SEng 5861
-

Mike Whalen

30

Language Patterns in More Detail

10/14/2010

SEng 5861
-

Mike Whalen

31

User Interaction Patterns

10/14/2010

SEng 5861
-

Mike Whalen

32

Model
-
View
-
Controller


Benefits


Supports independent

update of GUI (view)

and business logic

(model)


Allows display of

same data multiple ways


Better testability


Examples: Built into

most object
-
oriented

UI frameworks


Java, MFC (C++), Cocoa (Mac), .NET

10/14/2010

SEng 5861
-

Mike Whalen

34

Presentation Abstraction Control

10/14/2010

SEng 5861
-

Mike Whalen

35

Component Interaction Patterns

10/14/2010

SEng 5861
-

Mike Whalen

36

Method Call /
RPC

Observer
Notification

Mechanisms
for Response

Component Interaction Patterns II

10/14/2010

SEng 5861
-

Mike Whalen

37

Broker Pattern

10/14/2010

SEng 5861
-

Mike Whalen

38

What Have We Learned?


Some Examples of Architectural Patterns


What a Pattern Language is


How a PL can be used to relate patterns


10/14/2010

SEng 5861
-

Mike Whalen

39

Further Reading


Pattern
-
oriented Software Architecture:
System of Patterns
by Frank
Buschmann

et.
al


Currently 5 volumes!


Grounded in examples of real systems

10/14/2010

SEng 5861
-

Mike Whalen

40