41
1 The Unified Modeling Language (UML) Communicating Design It is hard to see high-level design concepts from source code Everyone likes to draw…but how do we draw pictures that we all understand? A dotted line means different things to different people

The Unified Modeling Language (UML) - Vanderbilt Universityjhoffert/cs279/slides/uml-slides.pdf · 2 UML • The Unified Modeling Language (UML) is a standard modeling language (language

  • Upload
    lyminh

  • View
    255

  • Download
    0

Embed Size (px)

Citation preview

Page 1: The Unified Modeling Language (UML) - Vanderbilt Universityjhoffert/cs279/slides/uml-slides.pdf · 2 UML • The Unified Modeling Language (UML) is a standard modeling language (language

1

The Unified Modeling Language

(UML)

Communicating Design

• It is hard to see high-level design concepts from source code

• Everyone likes to draw…but how do we draw pictures that we all understand?

• A dotted line means different things to different people

Page 2: The Unified Modeling Language (UML) - Vanderbilt Universityjhoffert/cs279/slides/uml-slides.pdf · 2 UML • The Unified Modeling Language (UML) is a standard modeling language (language

2

UML

• The Unified Modeling Language (UML) is a standard modeling language (language for drawing diagrams) that allows developers to express software designs using a visual notation

• UML covers a huge range of design areas

– Class Structure

– State

– User Interactions

– Object Interactions

• Few people probably know all of UML….

UML

• UML is a standard that is maintained by the Object Management Group (OMG)

• Before UML, there were multiple competing design methodologies:

– Rumbaugh's OMT

– Booch’s Method

– Etc.

• UML was created to unite the methodologies

Page 3: The Unified Modeling Language (UML) - Vanderbilt Universityjhoffert/cs279/slides/uml-slides.pdf · 2 UML • The Unified Modeling Language (UML) is a standard modeling language (language

3

UML

• UML is not loved by all

• Some people call UML the “Undefined Modeling Language”

• Regardless, UML is definitely the standard for software design

13 UML Diagram Types from the OMG

Page 4: The Unified Modeling Language (UML) - Vanderbilt Universityjhoffert/cs279/slides/uml-slides.pdf · 2 UML • The Unified Modeling Language (UML) is a standard modeling language (language

4

UML

• Why do we want UML?

• UML allows us to share high-level design ideas

• UML gives us a standard notation so that we both express the same design the same way (….maybe….)

• UML is unambiguous (…for some things…)

• Design is much more apparent from a UML diagram than source code

– Design patterns are easy to see in UML

• UML is independent of the implementation language

– A UML design could be realized in Java, C++, Perl, etc…

UML Class Diagrams

• A UML class diagram captures the classes in an application

• UML class diagrams show inheritance hierarchies

• UML class diagrams show relationships between classes

– Containment

– Inheritance

• UML class diagrams do not show state, sequencing of events, etc…

Page 5: The Unified Modeling Language (UML) - Vanderbilt Universityjhoffert/cs279/slides/uml-slides.pdf · 2 UML • The Unified Modeling Language (UML) is a standard modeling language (language

5

Classes

public class Car {

private String model;

public String manufacturer; //…poor OO

public void start(){…}

public void turn(int degrees){…}

}

Classes

public class Car {

private String model;

public String manufacturer; //…poor OO

public void start(){…}

public void turn(int degrees){…}

}

Car

-model: String

+manufacturer: String

Class

Name

Attributes

Page 6: The Unified Modeling Language (UML) - Vanderbilt Universityjhoffert/cs279/slides/uml-slides.pdf · 2 UML • The Unified Modeling Language (UML) is a standard modeling language (language

6

Classes

public class Car {

private String model;

public String manufacturer; //…poor OO

public Boolean start(){…}

protected void turn(int degrees){…}

}

Car

-model: String

+manufacturer: StringReturn

Type

Operation

Name

+start(driver: Person): Boolean

#turn(d: int): String

Operation

Parameters

Classes

public class Car {

private String model;

public String manufacturer; //…poor OO

public Boolean start(){…}

protected void turn(int degrees){…}

}

Car

-model: String

+manufacturer: StringReturn

Type

Operation

Name

+start(driver: Person): Boolean

~turn(d: int): String

Operation

Parameters

Page 7: The Unified Modeling Language (UML) - Vanderbilt Universityjhoffert/cs279/slides/uml-slides.pdf · 2 UML • The Unified Modeling Language (UML) is a standard modeling language (language

7

Classes

public class Car {

private String model;

public String manufacturer; //…poor OO

public Boolean start(){…}

protected void turn(int degrees){…}

}

Car

-model: String

+manufacturer: String

Private

Member

+start(driver: Person): Boolean

~turn(d: int): String

Package

Member

Public

Member

Java protected members

are accessible by any class

in the package, UML

protected members are not.

UML Member Visibility

• A UML private member (-) is equivalent to a Java private member. The member can only be accessed from the declaring class.

• Protected members (#) can be accessed by the declaring class and any subclasses that inherit the member.

• Package members (~) are visible to other members of the declaring class’ package.

• Public members (+) are accessible by any class.

Page 8: The Unified Modeling Language (UML) - Vanderbilt Universityjhoffert/cs279/slides/uml-slides.pdf · 2 UML • The Unified Modeling Language (UML) is a standard modeling language (language

8

UML…One Language to Try to Rule Them All

• UML tries to be able to represent all designs for all things– Be wary of this claim….

• UML is definitely excellent for designing software

• Even with software there are issues…– Example: Java protected is the equivalent of the union of the UML protected

and package members…

– If I use UML to talk about Java, protected means Java protected

– If I use UML to talk about C++…protected may mean something different

• A great page on some of the problems of representing Java design in UML: http://www.jot.fm/issues/issue_2003_09/article4/

• Some people want an executable UML specification

• UML Profiles are a mechanism for trying to customize UML for specific domains

Associations

• Associations are used to capture relationships between objects.

– Associations show developers how classes are related to each other.

• An association can capture an interaction between objects.

– A Person starts a Car (method call interaction).

• An association can capture a structural relationship.

– A Car has an Engine.

Car

-model: String

+manufacturer: String

+start(): Boolean

~turn(d: int): String

Engine

-model: String

+manufacturer: String

Page 9: The Unified Modeling Language (UML) - Vanderbilt Universityjhoffert/cs279/slides/uml-slides.pdf · 2 UML • The Unified Modeling Language (UML) is a standard modeling language (language

9

Modeling an Interaction

Car

-model: String

+manufacturer: String

+start(): Boolean

~turn(d: int): String

Person

….

public class Person {

private Car car;

public void foo() {

car.start();

}

}

starts0..1 1

Association

Name

Role Name

driver

Modeling an Interaction

Car

-model: String

+manufacturer: String

+start(): Boolean

~turn(d: int): String

Person

….

public class Person {

private Car car;

public void foo() {

car.start();

}

}

starts0..1 1

The arrow specifies that this

relationship is uni-directional. The

Car is not aware of the relationship.

Role Name

driver

Page 10: The Unified Modeling Language (UML) - Vanderbilt Universityjhoffert/cs279/slides/uml-slides.pdf · 2 UML • The Unified Modeling Language (UML) is a standard modeling language (language

10

Modeling an Interaction

Car

-model: String

+manufacturer: String

+start(d: Person):

Boolean

~turn(d: int): String

Person

….

public class Person {

private Car car;

public void foo() {

car.start(this);

}

}

starts0..1 1

If a Car is aware of its driver,

we use a bi-directional

association (no arrows)

Role Name

drivervehicle

public class Car{

private Person driver;

public void start(Driver d) {

this.driver = d;

}

}

Associations (cont.)

Adult Child1..* *complains

parent

If the subject is ambiguous, an

arrow is used to specify the

subject/object.

The objectThe subject

Page 11: The Unified Modeling Language (UML) - Vanderbilt Universityjhoffert/cs279/slides/uml-slides.pdf · 2 UML • The Unified Modeling Language (UML) is a standard modeling language (language

11

Association Types

Adult Child1..* *complains

parent

Association class stores

properties of the

relationshipComplaintInfo

ComplaintTopic: String

Multiplicity

Car

-model: String

+manufacturer: String

+start(d: Person):

Boolean

~turn(d: int): String

Person

….

• public class Person {

• private Car car;

• public void foo() {

• this.car.start(this);

• }

• }

starts0..1 1

Multiplicity specifies the

number of instances of the

attached class that can interact

with one instance of a class on

the other end of the association

drivervehicle

Page 12: The Unified Modeling Language (UML) - Vanderbilt Universityjhoffert/cs279/slides/uml-slides.pdf · 2 UML • The Unified Modeling Language (UML) is a standard modeling language (language

12

Multiplicity

Car

-model: String

+manufacturer: String

+start(d: Person):

Boolean

~turn(d: int): String

Person

….

public class Person {

private List<Car> cars;

public void foo() {

this.car.start(this);

}

}

starts0..* 1

Multiplicity can be expressed as

a range. In this example, one

Person can interact with zero or

more cars.

drivervehicle

Associations (cont.)

• Multiplicity Examples:

• [7], exactly 7 instances

• [0..1], zero or one instance

• [1..*], one or more instances

• [1..4], one to four instances

• [*], any number of instances

• [*..4], a maximum of four instances

Page 13: The Unified Modeling Language (UML) - Vanderbilt Universityjhoffert/cs279/slides/uml-slides.pdf · 2 UML • The Unified Modeling Language (UML) is a standard modeling language (language

13

Aggregation

DoorCar

….

public class Car {

private Door leftDoor;

private Door rightDoor;

}

10..2

Aggregation is denoted by a

line with an unfilled diamond.

The aggregated part (Arm) can

exist without the parent

(Person). The parent can also

exist without the part

Distinguishing Interactions from Aggregations

DoorCar

….

10..2

What is the difference between

these two in Java code?

DoorCar

….

10..2

Page 14: The Unified Modeling Language (UML) - Vanderbilt Universityjhoffert/cs279/slides/uml-slides.pdf · 2 UML • The Unified Modeling Language (UML) is a standard modeling language (language

14

public class Car {

private Door door;

}

public class Door {}

public class Car {

private Door door;

}

public class Door {

private Car myCar;

}

Page 15: The Unified Modeling Language (UML) - Vanderbilt Universityjhoffert/cs279/slides/uml-slides.pdf · 2 UML • The Unified Modeling Language (UML) is a standard modeling language (language

15

Distinguishing Interactions from Aggregations

DoorCar

….

10..2

What is the difference between

these two in Java code?

DoorCar

….

10..2

What is Wrong with this Example?

DoorCar

….

0..21

Page 16: The Unified Modeling Language (UML) - Vanderbilt Universityjhoffert/cs279/slides/uml-slides.pdf · 2 UML • The Unified Modeling Language (UML) is a standard modeling language (language

16

What is Wrong with this Example?

PointPolygon

….

0..*0..*

Aggregation

ArmPerson

….

0..2 1

When should a class be an aggregate of another class?

• Does performing an operation on the parent affect the parts?

– If a Person moves, the Person’s Arms also move.

• Do attributes of the parent propagate to the parent?

– If the Person has freckles, the Arms also have freckles.

Page 17: The Unified Modeling Language (UML) - Vanderbilt Universityjhoffert/cs279/slides/uml-slides.pdf · 2 UML • The Unified Modeling Language (UML) is a standard modeling language (language

17

Aggregation

ArmPerson

….

0..2 1

What’s wrong with this example?

Composition

ArmPerson

….

public class Person {

private Arm leftArm;

private Arm rightArm;

}

0..2 1

Composition is denoted by a

line with a filled diamond. The

composed part (Arm) cannot

exist without the parent

(Person)

The parent multiplicity must

be zero or one for a

composition relationship

Page 18: The Unified Modeling Language (UML) - Vanderbilt Universityjhoffert/cs279/slides/uml-slides.pdf · 2 UML • The Unified Modeling Language (UML) is a standard modeling language (language

18

What Does Composition Mean in Java?

ArmPerson

….

public class Person {

private Arm leftArm;

private Arm rightArm;

}

0..2 1

If leftArm is a composed part of

Person, it means that there are

no other references to the

leftArm instance. Why does this

matter?

What Does Composition Mean in Java?

public class Person {

private class Arm {…}

private Arm leftArm = new Arm();

private Arm rightArm = new Arm();

}

Page 19: The Unified Modeling Language (UML) - Vanderbilt Universityjhoffert/cs279/slides/uml-slides.pdf · 2 UML • The Unified Modeling Language (UML) is a standard modeling language (language

19

What Does Composition Mean in Java?

Are Person and Arm in a composition relationship in this example?

public class Person {

private Arm leftArm;

private Arm rightArm;

}

What Does Composition Mean in Java?

Rewrite the code so that Person and Arm are guaranteed to be in a

composition relationship:

public class Person {

private Arm leftArm;

private Arm rightArm;

}

Page 20: The Unified Modeling Language (UML) - Vanderbilt Universityjhoffert/cs279/slides/uml-slides.pdf · 2 UML • The Unified Modeling Language (UML) is a standard modeling language (language

20

What Does Composition Mean in Java?

Rewrite the code so that Person and Arm are guaranteed to be in a

composition relationship:

public class Person {

private Arm leftArm;

private Arm rightArm;

public void die(){

leftArm.die();

rightArm.die();

}

}

Generalization

• Generalization means that the more specialized type can be substituted for the more general type.

– Example: Inheritance is a generalization relationship.

– Generalization operates identically to inheritance.

Male

Person

Generalization

Super Class

Sub Class

Page 21: The Unified Modeling Language (UML) - Vanderbilt Universityjhoffert/cs279/slides/uml-slides.pdf · 2 UML • The Unified Modeling Language (UML) is a standard modeling language (language

21

Generalization

public class Person {}

public class Male extends Person {}

Male

Person

Generalization

Super Class

Sub Class

Realization

• Realization means that a class implements behavior

specified by an interface.

• Realization is similar to Java “implements.”

Person

<<Interface>>

Biped

Generalization

Super Class

Sub Class

walkOn2Legs ()

walkOn2Legs ()

Page 22: The Unified Modeling Language (UML) - Vanderbilt Universityjhoffert/cs279/slides/uml-slides.pdf · 2 UML • The Unified Modeling Language (UML) is a standard modeling language (language

22

Realization

public class Person implements Biped {….}

Person

<<Interface>>

Biped

Generalization

Super Class

Sub Class

walkOn2Legs ()

walkOn2Legs ()

Dependency

• If you change my dependency….I will probably break.

– Example: I depend on US driving rules. If you change the rules to require me to drive on the opposite side of the road and *update me*, I will break.

DrivingRulesPerson

….

Page 23: The Unified Modeling Language (UML) - Vanderbilt Universityjhoffert/cs279/slides/uml-slides.pdf · 2 UML • The Unified Modeling Language (UML) is a standard modeling language (language

23

Dependency

public class Person {

public void drive(DrivingRules rules){

…..

}

}

DrivingRulesPerson

….

<<use>>

Constraints

• Constraints are rules that must hold true for the elements

they are attached to:

Minor

ConstraintAge: int {Age < 18}

Page 24: The Unified Modeling Language (UML) - Vanderbilt Universityjhoffert/cs279/slides/uml-slides.pdf · 2 UML • The Unified Modeling Language (UML) is a standard modeling language (language

24

Constraints

• Notes are used to attach annotations to a UML model.

Minor

Age: int

Minors don’t

go to jail.

Instances

• UML 2 adds the notion of class instances– The format is “Instance Name : Class Name”

– All associations and values set for a class with an instance name only apply to that specific

instance

The instance name identifies

a specific instance of a class.

Jules : Person

….

Page 25: The Unified Modeling Language (UML) - Vanderbilt Universityjhoffert/cs279/slides/uml-slides.pdf · 2 UML • The Unified Modeling Language (UML) is a standard modeling language (language

25

Instances

• Instances can override properties – The format is “Instance Name : Class Name”

Jules : Person

weight: int = 220

Instances

• Instances are useful for showing very specific

interactions

Jules : Person

Doug : Person

CS278 : CSClass

teaches

teaches

Page 26: The Unified Modeling Language (UML) - Vanderbilt Universityjhoffert/cs279/slides/uml-slides.pdf · 2 UML • The Unified Modeling Language (UML) is a standard modeling language (language

26

More on UML

• UML isn’t perfect. Lot’s of parts of UML have ambiguity.

• UML Class Diagrams are just one part of UML.

– Other parts of UML: Statecharts, Sequence Diagrams, Activity

Diagrams, etc.

Exercises

Page 27: The Unified Modeling Language (UML) - Vanderbilt Universityjhoffert/cs279/slides/uml-slides.pdf · 2 UML • The Unified Modeling Language (UML) is a standard modeling language (language

27

Sequence Diagrams

• Sequence diagrams show the interaction of objects over time

• What method calls or interactions take place and in what

order

Sequence Diagrams

public class Person {

private Car vehicle;

private Key key;

public void startCar(){ vehicle.start(this.key);}

}

public class Car {

private Engine engine;

public void start(Key key){this.engine.powerStarter();}

}

public class Engine {

public void powerStarter();

}

Page 28: The Unified Modeling Language (UML) - Vanderbilt Universityjhoffert/cs279/slides/uml-slides.pdf · 2 UML • The Unified Modeling Language (UML) is a standard modeling language (language

28

A Sequence Diagram

driver:

Personvehicle:Car :Engine

startCar()

powerStarter()

start(key)

Time

A Sequence Diagram

driver:

Personvehicle:Car :Engine

startCar()

powerStarter()

start(key)

The boxes at the top indicate the

objects that are participating

Page 29: The Unified Modeling Language (UML) - Vanderbilt Universityjhoffert/cs279/slides/uml-slides.pdf · 2 UML • The Unified Modeling Language (UML) is a standard modeling language (language

29

A Sequence Diagram

driver:

Personvehicle:Car :Engine

startCar()

powerStarter()

start(key)

Object instances can be named or

anonymous. The naming scheme is

[instance name]:[class name]

Anonymous objects can be

used if there is only one

instance of each class and the

names aren’t needed for

references.

A Sequence Diagram

driver:

Personvehicle:Car :Engine

startCar()

powerStarter()

start(key)

The dotted

lines indicate

object life-

lines

Page 30: The Unified Modeling Language (UML) - Vanderbilt Universityjhoffert/cs279/slides/uml-slides.pdf · 2 UML • The Unified Modeling Language (UML) is a standard modeling language (language

30

A Sequence Diagram

driver:

Personvehicle:Car :Engine

startCar()

powerStarter()

start(key)

This X and the end of the

life-line indicates the object

is destroyed … not usually

needed in Java

A Sequence Diagram

driver:

Personvehicle:Car :Engine

startCar()

powerStarter()

start(key)

Messages or method

invocations between objects

are denoted with lines

between life-lines

The message type and

parameters

Page 31: The Unified Modeling Language (UML) - Vanderbilt Universityjhoffert/cs279/slides/uml-slides.pdf · 2 UML • The Unified Modeling Language (UML) is a standard modeling language (language

31

A Sequence Diagram

driver:

Personvehicle:Car :Engine

startCar()

powerStarter()

start(key)

The boxes on the life-line

lines indicate activations or

the time for the object is

blocked processing a message

Sequence Diagrams

public class Person {

private Car vehicle;

private Key key;

public void startCar(){

if(vehicle.insertKey(this.key)){

vehicle.start(this.key);

}

}

}

public class Car {

private Engine engine;

private boolean keyInIgnition = false;

public boolean insertKey(Key key){

keyInIgnition = keyFits(key);

return keyInIgnition;

}

public void start(){this.engine.powerStarter();}

private boolean keyFits(Key k){…}

}

Page 32: The Unified Modeling Language (UML) - Vanderbilt Universityjhoffert/cs279/slides/uml-slides.pdf · 2 UML • The Unified Modeling Language (UML) is a standard modeling language (language

32

Conditional Flow

driver:

Personvehicle:Car :Engine

startCar()

powerStarter()

canStart = insertKey(key)

[canStart] start()

The variable “canStart” is

declared to be the return value

of the message

Conditional Flow

driver:

Personvehicle:Car :Engine

startCar()

powerStarter()

canStart = insertKey(key)

[canStart] start()

“[canStart]” is a guard

indicating a condition that must

hold true before the start()

message

Page 33: The Unified Modeling Language (UML) - Vanderbilt Universityjhoffert/cs279/slides/uml-slides.pdf · 2 UML • The Unified Modeling Language (UML) is a standard modeling language (language

33

Return Values and Conditional Flow

driver:

Personvehicle:Car :Engine

startCar()

powerStarter()

insertKey(key)

[canStart] start()

canStart

Sequence Diagrams

public class Person {

private Car vehicle;

private Key key;

public void startCar(){

if(vehicle.insertKey(this.key)){

vehicle.start(this.key);

}

}

}

public class Car {

private Engine engine;

private boolean keyInIgnition = false;

public boolean insertKey(Key key){

keyInIgnition = keyFits(key);

return keyInIgnition;

}

public void start(){this.engine.powerStarter();}

private boolean keyFits(Key k){…}

}

We haven’t modeled

this yet

Page 34: The Unified Modeling Language (UML) - Vanderbilt Universityjhoffert/cs279/slides/uml-slides.pdf · 2 UML • The Unified Modeling Language (UML) is a standard modeling language (language

34

Conditional Flow

driver:

Personvehicle:Car :Engine

startCar()

powerStarter()

canStart = insertKey(key)

[canStart] start()

keyFits(key)

This is a nested call

from the object

back to itself

Conditional Flow

driver:

Personvehicle:Car :Engine

startCar()

powerStarter()

canStart = insertKey(key)

[canStart] start()

keyFits(key)

We have a nested

activation

Page 35: The Unified Modeling Language (UML) - Vanderbilt Universityjhoffert/cs279/slides/uml-slides.pdf · 2 UML • The Unified Modeling Language (UML) is a standard modeling language (language

35

Conditional Flow

driver:

Personvehicle:Car :Engine

startCar()

powerStarter()

canStart = insertKey(key)

[canStart] start()

keyFits(key)

A loop with a

condition

Loop [while !started]

Conditional Flow

driver:

Personvehicle:Car :Engine

startCar()canStart = insertKey(key)

[canStart] start()

keyFits(key)

A star indicates a

message that is sent

multiple times

* [while !started] powerStarter()

Page 36: The Unified Modeling Language (UML) - Vanderbilt Universityjhoffert/cs279/slides/uml-slides.pdf · 2 UML • The Unified Modeling Language (UML) is a standard modeling language (language

36

Tips

• Don’t model everything…just what is necessary.

– Only model return calls if explicitly needed to refer to the return value

– Only model messages that are important to show, may not be necessary to model every call from an object to itself

• Create multiple simple sequence diagrams rather than a few complicated ones

– Each sequence diagram models a different path/outcome

Activity Diagrams

Post VideoCheck for

Copyright

ViolationSave Video

On Content

Server 1

Save Video

On Content

Server 2

Enter Video

in Database

[violation] [!violation]

Page 37: The Unified Modeling Language (UML) - Vanderbilt Universityjhoffert/cs279/slides/uml-slides.pdf · 2 UML • The Unified Modeling Language (UML) is a standard modeling language (language

37

Activity Diagrams

The filled circle denotes the

starting point of the flow

Activity Diagrams

Post VideoCheck for

Copyright

ViolationSave Video

On Content

Server 1

Save Video

On Content

Server 2

Enter Video

in Database

[violation] [!violation]

Activity DiagramsActivity Diagrams

Post VideoCheck for

Copyright

ViolationSave Video

On Content

Server 1

Save Video

On Content

Server 2

Enter Video

in Database

[violation] [!violation]

The filled circle with a surrounding

border indicates the end of the flow

Page 38: The Unified Modeling Language (UML) - Vanderbilt Universityjhoffert/cs279/slides/uml-slides.pdf · 2 UML • The Unified Modeling Language (UML) is a standard modeling language (language

38

Activity DiagramsActivity Diagrams

Post VideoCheck for

Copyright

ViolationSave Video

On Content

Server 1

Save Video

On Content

Server 2

Enter Video

in Database

[violation] [!violation]

Activities represent the actions that are

taking place in the process

Activity Diagrams

Lines indicate flow between activities

Activity Diagrams

Post VideoCheck for

Copyright

ViolationSave Video

On Content

Server 1

Save Video

On Content

Server 2

Enter Video

in Database

[violation] [!violation]

Page 39: The Unified Modeling Language (UML) - Vanderbilt Universityjhoffert/cs279/slides/uml-slides.pdf · 2 UML • The Unified Modeling Language (UML) is a standard modeling language (language

39

Activity Diagrams

“[xyz]” indicate conditions for moving

between activities

Activity Diagrams

Post VideoCheck for

Copyright

ViolationSave Video

On Content

Server 1

Save Video

On Content

Server 2

Enter Video

in Database

[violation] [!violation]

Activity DiagramsActivity Diagrams

Post VideoCheck for

Copyright

ViolationSave Video

On Content

Server 1

Save Video

On Content

Server 2

Enter Video

in Database

[violation] [!violation]

Diamonds are decision points in the

flow

Page 40: The Unified Modeling Language (UML) - Vanderbilt Universityjhoffert/cs279/slides/uml-slides.pdf · 2 UML • The Unified Modeling Language (UML) is a standard modeling language (language

40

Activity Diagrams

A bar with a single line entering and multiple

lines exiting represents a fork or the beginning

of a parallel set of activities

Activity Diagrams

Post VideoCheck for

Copyright

ViolationSave Video

On Content

Server 1

Save Video

On Content

Server 2

Enter Video

in Database

[violation] [!violation]

Activity DiagramsActivity Diagrams

Post VideoCheck for

Copyright

ViolationSave Video

On Content

Server 1

Save Video

On Content

Server 2

Enter Video

in Database

[violation] [!violation]

A bar with a multiple lines entering and a single line exiting represents

a join or the end of a parallel set of activities. All incoming flows must

reach the join before the exiting flow is followed.

Page 41: The Unified Modeling Language (UML) - Vanderbilt Universityjhoffert/cs279/slides/uml-slides.pdf · 2 UML • The Unified Modeling Language (UML) is a standard modeling language (language

41

Swim LanesActivity Diagrams

Post VideoCheck for

Copyright

ViolationSave Video

On Content

Server 1

Save Video

On Content

Server 2

Enter Video

in Database

[violation] [!violation]

Video Screener Video Archiver