21
Unified Modeling Language (UML) Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park

Unified Modeling Language (UML) Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park

  • View
    215

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Unified Modeling Language (UML) Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park

Unified Modeling Language (UML)

Fawzi Emad

Chau-Wen Tseng

Department of Computer Science

University of Maryland, College Park

Page 2: Unified Modeling Language (UML) Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park

Overview

Unified Modeling Language (UML)Models & views

Class diagrams

Sequence diagrams

Page 3: Unified Modeling Language (UML) Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park

UML

UML (Unified Modeling Language)Graphic modeling language for describing object-oriented software

Started in 1994

Combined notations from 3 leading OO methods

OMT (James Rumbaugh)

OOSE (Ivar Jacobson)

Booch (Grady Booch)

Page 4: Unified Modeling Language (UML) Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park

UML Motivation

Software growing larger & complexDifficult to analyze

Need to describe software designClearly

Concisely

Correctly

UML equivalent to software “blueprint”Provides simple yet clear abstraction for software

Computer-aided software engineering (CASE)Tools for generating & analyzing UML

Page 5: Unified Modeling Language (UML) Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park

Definitions

ModelAbstraction describing (all or part of) system

ViewDepicts selected aspects of a model using set of diagrams

DiagramActual depiction of aspect of model

NotationSet of graphical / textual rules for representing view

Page 6: Unified Modeling Language (UML) Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park

Models & Views

System

Model 1

Model 2

View 1

View 3

View 2

Page 7: Unified Modeling Language (UML) Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park

UML

Industry standard

Many featuresLarge collection of notations

Multiple views

Multiple diagrams

We focus mainly onLogical view of relationship between classes

Page 8: Unified Modeling Language (UML) Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park

UML Views

Use-CaseShow external user (actor) view of system

LogicalShow how functionality is implemented

ComponentShow organization of code components

DeploymentShow assignment of code to physical computers

Page 9: Unified Modeling Language (UML) Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park

(Some) UML Diagrams

ClassDescribe static structure of the classes in system

SequenceDescribe dynamic behavior between users and objects

Use caseDescribe functional behavior seen by (external) user

StateDescribe dynamic behavior of objects as finite state machine

ActivityModel dynamic behavior of a system as a flowchart

Page 10: Unified Modeling Language (UML) Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park

UML Conventions

Rectangles classes or instances

Ovals functions or use cases

Types preceded by colon, not underlined:SimpleWatch

Instances underlined namesmyWatch:SimpleWatch

Diagrams graphsNodes entities

Arcs relationships between entities

Page 11: Unified Modeling Language (UML) Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park

Class Diagrams

Batteryload()

1

2

Timenow()

PushButtonstatepush()release()

1

1

1

1

1

2

blinkIdxblinkSeconds()blinkMinutes()blinkHours()stopBlinking()referesh()

LCDDisplay

SimpleWatch

Class

AssociationMultiplicity

Attributes

Operations

Class diagrams represent structure of system

Page 12: Unified Modeling Language (UML) Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park

Sequence DiagramObject

MessageActivation

Sequence diagrams represent behavior as interactions

blinkHours()

blinkMinutes()

incrementMinutes()

refresh()

commitNewTime()

stopBlinking()

pressButton1()

pressButton2()

pressButtons1And2()

pressButton1()

:WatchUser:Time:LCDDisplay:SimpleWatch

Page 13: Unified Modeling Language (UML) Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park

Use Case Diagrams

WatchUser WatchRepairPerson

ReadTime

SetTime

ChangeBattery

Actor

Use case

PackageSimpleWatch

Use case diagrams represent functionality of system from external user’s point of view

Page 14: Unified Modeling Language (UML) Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park

button1&2Pressed

button1&2Pressed

button1Pressed

button2Pressed

button2Pressed

button2Pressed

button1Pressed

button1&2Pressed IncrementMinutes

IncrementHours

BlinkHours

BlinkSeconds

BlinkMinutes

IncrementSeconds

StopBlinking

State DiagramsStateInitial state

Final state

Transition

Event

Page 15: Unified Modeling Language (UML) Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park

UML Class Diagrams

Represent the (static) structure of the system

During analysis Used to model problem domain concepts

During detailed design Used to model classes

Page 16: Unified Modeling Language (UML) Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park

Class Diagrams

Class containsName

State

Behavior

Page 17: Unified Modeling Language (UML) Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park

Class Diagrams

Types may be included

Only class name is required

Page 18: Unified Modeling Language (UML) Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park

UML Sequence Diagrams

Represent behavior in terms of interactions

During requirements analysisUsed to refine use case descriptions

During system design Used to refine subsystem interfaces

Page 19: Unified Modeling Language (UML) Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park

Sequence Diagram Notation

Columns Classes

Arrows Messages

Narrow rectangles Activations

Dashed lines Lifelines

Page 20: Unified Modeling Language (UML) Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park

Sequence Diagram Example

Sequence of events for printer queue

Page 21: Unified Modeling Language (UML) Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park

Sequence Diagram Observations

Represents behavior in terms of interactions

Complement the class diagrams which represent structure

Useful for finding participating objects