lecture 17: (architecture v) - university of north ... 2008...lecture 17: (architecture v) ......

43
1 Lecture 17: (Architecture V) Software System Design and Implementation ITCS/ITIS 6112/8112 091 Fall 2008 Dr. Jamie Payton Department of Computer Science University of North Carolina at Charlotte Oct. 30, 2008

Upload: trinhxuyen

Post on 08-Mar-2018

215 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Lecture 17: (Architecture V) - University of North ... 2008...Lecture 17: (Architecture V) ... Architecture Description Language (ADL) ... • Don’t define assignment based on names

1

Lecture 17:(Architecture V)

Software System Design and ImplementationITCS/ITIS 6112/8112 091

Fall 2008

Dr. Jamie PaytonDepartment of Computer Science

University of North Carolina at Charlotte

Oct. 30, 2008

Page 2: Lecture 17: (Architecture V) - University of North ... 2008...Lecture 17: (Architecture V) ... Architecture Description Language (ADL) ... • Don’t define assignment based on names

22

Representing Software Architecture:The 4+1 View Approach

Logical View

End-user Functionality

Implementation View

Programmers Configuration management

Process View

PerformanceScalabilityThroughput

System integrators

Deployment View

System topologyCommunication

Provisioning

System engineering

Use Case View

Page 3: Lecture 17: (Architecture V) - University of North ... 2008...Lecture 17: (Architecture V) ... Architecture Description Language (ADL) ... • Don’t define assignment based on names

33

Architecture metamodel

Page 4: Lecture 17: (Architecture V) - University of North ... 2008...Lecture 17: (Architecture V) ... Architecture Description Language (ADL) ... • Don’t define assignment based on names

4

The Logical View

Addresses functional requirements and expresses the key abstractions

Classes, ComponentsExpress the relationships between the logical components

Use, generalize, aggregateDefine the important interfaces of the components and connectors associated with this viewArchitectural style can help define the structure and semantics of the elements

Logical View

Page 5: Lecture 17: (Architecture V) - University of North ... 2008...Lecture 17: (Architecture V) ... Architecture Description Language (ADL) ... • Don’t define assignment based on names

55

The Process View

Takes into account non-functional requirements performance, availability, etc.

Deals with concurrency, showing the different threads of control

Intra-process threadsInter-process coordination (messages to and from different servers)

Process View

Page 6: Lecture 17: (Architecture V) - University of North ... 2008...Lecture 17: (Architecture V) ... Architecture Description Language (ADL) ... • Don’t define assignment based on names

66

The Process View

Components for the process view include:Processes and threads

Connectors includeMessages, shared memory, pipes

Possible styles for the process views:Client/Server, MVC, pipe and filter

Process View

Page 7: Lecture 17: (Architecture V) - University of North ... 2008...Lecture 17: (Architecture V) ... Architecture Description Language (ADL) ... • Don’t define assignment based on names

77

The Development View

Defines the actual software modules to be constructedModules should be at the level where they can be implemented by small set of developers

Classes, Packages, SubsystemsThis view should clearly define the import and output relations

Provided and required interfaces…

DevelopmentView

Page 8: Lecture 17: (Architecture V) - University of North ... 2008...Lecture 17: (Architecture V) ... Architecture Description Language (ADL) ... • Don’t define assignment based on names

88

The Physical View

Maps the software components to the hardware (deployment)Elements

networks, processes, and tasksConnectors

network links and inter-process communication

Different physical views might be needed for development, test and production

PhysicalView

Page 9: Lecture 17: (Architecture V) - University of North ... 2008...Lecture 17: (Architecture V) ... Architecture Description Language (ADL) ... • Don’t define assignment based on names

99

The +1 View - Scenarios

Scenarios are abstractions of the most important requirements

Map closely to use casesIn fact, we usually substitute use cases here

Ties the other views togetherThe scenario view is redundant to the other views (+1)

Ties the architecture together

Scenarios

Page 10: Lecture 17: (Architecture V) - University of North ... 2008...Lecture 17: (Architecture V) ... Architecture Description Language (ADL) ... • Don’t define assignment based on names

1010

The +1 View - Scenarios

Why scenarios:A mechanism to discover the key architectural elements and connectorsValidation of the architecture design after the other views are createdAddresses the concerns of both the functional and non-functional requirements

Scenarios

Page 11: Lecture 17: (Architecture V) - University of North ... 2008...Lecture 17: (Architecture V) ... Architecture Description Language (ADL) ... • Don’t define assignment based on names

1111

Adapting Views

Not all systems require all viewsSingle process (ignore process view)Small program (ignore implementation view)Single processor (ignore deployment view)

Some systems require additional viewsData viewSecurity viewOther aspects

Page 12: Lecture 17: (Architecture V) - University of North ... 2008...Lecture 17: (Architecture V) ... Architecture Description Language (ADL) ... • Don’t define assignment based on names

1212

Models

Non-standard modelsExpressed without universally defined semanticsExample: box and line diagrams, block diagrams

ModelsData flow, control flowUse casesInteraction models (e.g., sequence diagrams)Data models (e.g., ERA diagrams)Object models (e.g., class diagrams)Many more…

Modeling notationsArchitecture Description Language (ADL)Unified Modeling Language (UML)

Page 13: Lecture 17: (Architecture V) - University of North ... 2008...Lecture 17: (Architecture V) ... Architecture Description Language (ADL) ... • Don’t define assignment based on names

1313

Architecture Metamodel

Page 14: Lecture 17: (Architecture V) - University of North ... 2008...Lecture 17: (Architecture V) ... Architecture Description Language (ADL) ... • Don’t define assignment based on names

14

Architectural Models

Architecture is documented from many perspectives (views)Static structural model• Shows the major system components

Dynamic process model • Shows the process structure of the system

Interface model • Defines component interfaces

Relationships model • Shows component relationships

Distribution model • Shows how components are physically distributed across computers

Page 15: Lecture 17: (Architecture V) - University of North ... 2008...Lecture 17: (Architecture V) ... Architecture Description Language (ADL) ... • Don’t define assignment based on names

15

Notations for Architectural Specifications

Box-and-line diagrams, component diagrams, class diagrams, textRelationship model

Deployment diagramsDistribution model

Text, class diagramsInterfaces model

State diagrams, sequence diagram, collaboration diagrams, activity diagrams, box-and-line diagrams, use case models

Dynamic Process Model

Box-and-line diagrams, class diagrams, package diagrams, component diagrams, deployment diagrams

Static Structural Model

Useful NotationsType of Specification

Page 16: Lecture 17: (Architecture V) - University of North ... 2008...Lecture 17: (Architecture V) ... Architecture Description Language (ADL) ... • Don’t define assignment based on names

1616

Logical View:UML Packages

A UML package is a collection of model elements, called package membersUseful for architectural modelingCaptures static models

• Particularly, decomposition• Describes modules, their parts, and their relationships

Typically, a package containsClasses in the same inheritance hierarchyClasses related to one another with composition relationshipClasses that communicate or collaborate a lot

Page 17: Lecture 17: (Architecture V) - University of North ... 2008...Lecture 17: (Architecture V) ... Architecture Description Language (ADL) ... • Don’t define assignment based on names

17

Package Diagram Example

Page 18: Lecture 17: (Architecture V) - University of North ... 2008...Lecture 17: (Architecture V) ... Architecture Description Language (ADL) ... • Don’t define assignment based on names

18

UML Dependency Relations

Examples: D uses I, D depends for compilation on I, D imports IRepresented by dependency arrows: stereotyped dashed arrows

A dependency relation holds between two entities D and I when a change in I (the independent entity) may affect D (the dependent entity).

A dependency relation holds between two entities D and I when a change in I (the independent entity) may affect D (the dependent entity).

Page 19: Lecture 17: (Architecture V) - University of North ... 2008...Lecture 17: (Architecture V) ... Architecture Description Language (ADL) ... • Don’t define assignment based on names

19

Dependency Relation Example

Page 20: Lecture 17: (Architecture V) - University of North ... 2008...Lecture 17: (Architecture V) ... Architecture Description Language (ADL) ... • Don’t define assignment based on names

20

Logical View:UML Interfaces

A UML interface is a named collection of public attributes and abstract operations

Represented by a stereotyped class symbol (later)Represented by special ball and socket symbols

Note: this use of the term “interface” is different from out previous use as a communications boundary

More like “interface” = class without implementation

Page 21: Lecture 17: (Architecture V) - University of North ... 2008...Lecture 17: (Architecture V) ... Architecture Description Language (ADL) ... • Don’t define assignment based on names

21

Provided and Required Interfaces

A class or component realizes an interface when it includes its attributes and implements its operationsProvided interface

Realized by a class or componentRepresented by a ball or lollipop symbol

Required interfaceNeeded by a class or componentRepresented by a socket symbol

The assembly connector wires interfaces together

Page 22: Lecture 17: (Architecture V) - University of North ... 2008...Lecture 17: (Architecture V) ... Architecture Description Language (ADL) ... • Don’t define assignment based on names

22

Interface Symbols Example

Page 23: Lecture 17: (Architecture V) - University of North ... 2008...Lecture 17: (Architecture V) ... Architecture Description Language (ADL) ... • Don’t define assignment based on names

2323

Logical and Process View:UML Interaction Diagrams

Notations for dynamic modeling of collaborations among individualsUML interaction diagrams

Sequence diagram• Shows sequence of messages passed among communicating individuals• Highlight temporal nature of communication

Communication diagram• Shows messages passed among communicating individuals• Highlights collaborations

Interaction overview diagram• Activity diagram + Sequence diagrams

Timing diagram• Shows change in state of individual over time

Page 24: Lecture 17: (Architecture V) - University of North ... 2008...Lecture 17: (Architecture V) ... Architecture Description Language (ADL) ... • Don’t define assignment based on names

2424

Example Interaction Diagrams:Sequence Diagram

Page 25: Lecture 17: (Architecture V) - University of North ... 2008...Lecture 17: (Architecture V) ... Architecture Description Language (ADL) ... • Don’t define assignment based on names

2525

Example Interaction Diagrams:Collaboration Diagram

Page 26: Lecture 17: (Architecture V) - University of North ... 2008...Lecture 17: (Architecture V) ... Architecture Description Language (ADL) ... • Don’t define assignment based on names

2626

UML Sequence Diagrams

Most widely used notation for describing interactionsClearly expresses message flow between individualsHighlights time ordering of interactions

Page 27: Lecture 17: (Architecture V) - University of North ... 2008...Lecture 17: (Architecture V) ... Architecture Description Language (ADL) ... • Don’t define assignment based on names

2727

UML Sequence Diagram Notation:Frame

Rectangle that encloses the diagram with pentagon-shaped name compartment

Name can be simple name or operation name (with params)

:User :Button

press

actionPerformed(event)toggle

:ButtonListener :Light

getState()

sd ButtonPress name compartment

Page 28: Lecture 17: (Architecture V) - University of North ... 2008...Lecture 17: (Architecture V) ... Architecture Description Language (ADL) ... • Don’t define assignment based on names

2828

UML Sequence Diagram Notation:Lifeline

Represents a participating individual Usually an object (instance of class)

Modeled as rectangle with dashed line extending downTime is represented vertically in diagramDashed line represents individual’s existenceRectangle is labeled with lifeline identifier

Lifelineclient

:Component

supplier

create

Xdestroy

sd UseComponent

Page 29: Lecture 17: (Architecture V) - University of North ... 2008...Lecture 17: (Architecture V) ... Architecture Description Language (ADL) ... • Don’t define assignment based on names

2929

Lifeline Creation and DestructionNew object appears at the point it is createdDestroyed object has a truncated lifeline

marked with an XPersistent objects have lifelines that run the length of the diagram

client

:Component

supplier

create

Xdestroy

sd UseComponent

Page 30: Lecture 17: (Architecture V) - University of North ... 2008...Lecture 17: (Architecture V) ... Architecture Description Language (ADL) ... • Don’t define assignment based on names

3030

UML Sequence Diagram Notation:Message Arrows

Three typesSynchronous messagesAsynchronous messagesSynchronous message return or instance creation

:User :Button

press

actionPerformed(event)toggle

:ButtonListener :Light

getState()

sd ButtonPress

Page 31: Lecture 17: (Architecture V) - University of North ... 2008...Lecture 17: (Architecture V) ... Architecture Description Language (ADL) ... • Don’t define assignment based on names

3131

Message Specification Format

VariableSimple name of a variable assigned a resultOptional; if omitted, so is the equals sign

nameSimple name of the message

argumentListComma-separated list of arguments in parenthesesPossible formats:• varName = paramName• paramName = argumentValue• —

Optional; parentheses may appear even if omittedMessage specification may be * (any message)

variable = name argumentList

Page 32: Lecture 17: (Architecture V) - University of North ... 2008...Lecture 17: (Architecture V) ... Architecture Description Language (ADL) ... • Don’t define assignment based on names

3232

Message Specification Examples

hellohello()msg = getMessage( helloMessage )x = sin( a/2 )x = sin( angle = a/2 )trim( result = aString )Warning

Assigning a value to a parameter and assigning a returned “out” parameter to a variable cannot be distinguishedUse variable/parameter assignments in correct order of parameters• Don’t define assignment based on names of parameters

Page 33: Lecture 17: (Architecture V) - University of North ... 2008...Lecture 17: (Architecture V) ... Architecture Description Language (ADL) ... • Don’t define assignment based on names

3333

UML Sequence Diagram Notation:Execution Occurrence

Indicates an object is activeObject is active if one or more operations is active• Operation is executing

Process is running code• Operation is suspended

Waiting on return of control from synchronous message

:User :Button

press

actionPerformed(event)toggle

:ButtonListener :Light

getState()

sd ButtonPress

executionoccurrence

Page 34: Lecture 17: (Architecture V) - University of North ... 2008...Lecture 17: (Architecture V) ... Architecture Description Language (ADL) ... • Don’t define assignment based on names

34

Deployment View:Deployment Diagrams

A UML deployment diagram models computational resources, communication paths among them, and artifacts that reside and execute on them.Used to show

Real and virtual machines used in a systemCommunication paths between machinesProgram and data files realizing the system• Residence• Execution

Page 35: Lecture 17: (Architecture V) - University of North ... 2008...Lecture 17: (Architecture V) ... Architecture Description Language (ADL) ... • Don’t define assignment based on names

35

UML Nodes

A UML node is a computational resource.Device• physical processing unit, such as a computer

Execution environment• software system that implements a virtual machine, such as an

operating system or language interpreter

Represented in UML by box or slab symbolsStereotyped with «device» or «execution environment»Types and instances• Types have names• Instance have underlined labels of the form name : type• Name or type may be suppressed, but not both

Page 36: Lecture 17: (Architecture V) - University of North ... 2008...Lecture 17: (Architecture V) ... Architecture Description Language (ADL) ... • Don’t define assignment based on names

36

Node Symbols Example

Page 37: Lecture 17: (Architecture V) - University of North ... 2008...Lecture 17: (Architecture V) ... Architecture Description Language (ADL) ... • Don’t define assignment based on names

37

Deployment Diagram Rules

Computational resources are nodesCommunication paths are solid lines between nodes

May be labeledMay have multiplicities and role names

Artifact symbols may Appear within node symbolsBe listed within node symbolsBe connected to node symbols by dependency arrows stereotyped with «deploy»

Page 38: Lecture 17: (Architecture V) - University of North ... 2008...Lecture 17: (Architecture V) ... Architecture Description Language (ADL) ... • Don’t define assignment based on names

38

Deployment Diagram Example

«device»GameDataServer

«device»ClientPC

«artifact»GameClient

TCP/IP

«device»ServerPC

«artifact»GameServer

«DB»GameData

RulesBoardImageTokenImage

RMI

*

1

«deploy»

Page 39: Lecture 17: (Architecture V) - University of North ... 2008...Lecture 17: (Architecture V) ... Architecture Description Language (ADL) ... • Don’t define assignment based on names

39

Software Components

A software component is a reusable, replaceable piece of softwareComponent-based development

Products are designed and built using commercially available or custom-built software components

Page 40: Lecture 17: (Architecture V) - University of North ... 2008...Lecture 17: (Architecture V) ... Architecture Description Language (ADL) ... • Don’t define assignment based on names

40

UML Component Diagrams

A UML component is a modular, replaceable unit with well-defined interfaces.

Component symbols are rectangles containing namesStereotyped «component» or have component symbol in upper right-hand corner

UML component diagramShows componentstheir relationships to their environmentand their internal structure

Page 41: Lecture 17: (Architecture V) - University of North ... 2008...Lecture 17: (Architecture V) ... Architecture Description Language (ADL) ... • Don’t define assignment based on names

41

Component Internal Structure

Components can contain other components or classes showing how they are builtA delegation connector ties a component interface to one or more internal classes or components that realize or use the interface

Solid arrowsStereotyped with «delegate»

Page 42: Lecture 17: (Architecture V) - University of North ... 2008...Lecture 17: (Architecture V) ... Architecture Description Language (ADL) ... • Don’t define assignment based on names

42

Component Internals Example

Page 43: Lecture 17: (Architecture V) - University of North ... 2008...Lecture 17: (Architecture V) ... Architecture Description Language (ADL) ... • Don’t define assignment based on names

43

Component Diagram Uses

Static models of software components (reusable and replaceable parts)Model program components

Architectural modelsDetailed design modelsRelationship to environment

Model internal structure of components