uml diagrams unified modeling language for object oriented programming unified modeling language for...

9
UML DIAGRAMS Unified Modeling Language for Object Oriented Programming

Upload: phillip-welch

Post on 01-Jan-2016

244 views

Category:

Documents


0 download

TRANSCRIPT

UML DIAGRAMSUML DIAGRAMSUnified Modeling Language

for Object Oriented ProgrammingUnified Modeling Language

for Object Oriented Programming

UML Diagrams UML Diagrams

UML stands for Unified Modeling Language

The goal is for UML to become a common language for creating models of object oriented computer software.

Our diagrams aim to represent the objects in our programs and how they relate to each other!

UML stands for Unified Modeling Language

The goal is for UML to become a common language for creating models of object oriented computer software.

Our diagrams aim to represent the objects in our programs and how they relate to each other!

UML DiagramsUML DiagramsModeling a Class

Class Icon

Modeling a Class

Class Icon

Enemy

health : float pos : PVector

void update() boolean escaped()

CLASSCLASS

ATTRIBUTESATTRIBUTES

FUNCTIONS/FUNCTIONS/METHODSMETHODS

UML DiagramsUML DiagramsModeling a Class

Class Icon

Modeling a Class

Class Icon

Wave

enemyList : ArrayList waveNum : int

void createWave() void update()

CLASSCLASS

ATTRIBUTESATTRIBUTES

FUNCTIONS/FUNCTIONS/METHODSMETHODS

Composition Relationships Composition

Relationships Each instance of type Wave contains an list of type Enemy . This is a relationship known as composition

Each instance of type Wave contains an list of type Enemy . This is a relationship known as composition

WaveWave EnemyEnemy

- Wave contains Enemies- Wave contains Enemies- The ‘life’ of an Enemy depends on the ‘life’ of the Wave- The ‘life’ of an Enemy depends on the ‘life’ of the Wave- Wave is the “owner” of Enemy- Wave is the “owner” of Enemy- Enemies are created only when a Wave is created and - Enemies are created only when a Wave is created and destroyed when Waves are destroyeddestroyed when Waves are destroyed

0..10..1 1..1..**

Aggregation RelationshipAggregation Relationship

Aggregation is shown with an open diamond.

The aggregate class (the class with the unfilled diamond touching it) is in some way part of the “whole”

The other class in the relationship is “part” of that whole but doesn’t require the “whole” to exist. (‘*’ shows the Pond can have many Ducks)

The Duck survives if the Pond is removed

Aggregation is shown with an open diamond.

The aggregate class (the class with the unfilled diamond touching it) is in some way part of the “whole”

The other class in the relationship is “part” of that whole but doesn’t require the “whole” to exist. (‘*’ shows the Pond can have many Ducks)

The Duck survives if the Pond is removed

PondPond DuckDuck0..10..1 0..0..**

Association RelationshipAssociation RelationshipObjects are associated when neither is a “part” of the other AND each object can “exist” separately

Objects are associated when neither is a “part” of the other AND each object can “exist” separately

StudentStudent CourseCourse0..*0..* 0..*0..*

0..*0..* - shows ‘multiplicity’, the possible number instances - shows ‘multiplicity’, the possible number instances of that objectof that object

InheritanceInheritance

RocketRocketLauncherLauncher LaserLaser

TowerTower

What type of relationship?What type of relationship?

Car - Engine

Car - Floor Mats

Car - Gas Tank

Car - Driver

Car - Engine

Car - Floor Mats

Car - Gas Tank

Car - Driver

CompositionComposition

CompositionComposition

AggregationAggregation

AssociationAssociation