SlideShare a Scribd company logo
1 of 47
UML for Java
Programmers
Object Mentor, Inc.
Or
How Uncle Bob us e s
UML.

www.objectmentor.com

fitnesse.org

www.xprogramming

www.junit.org

Copyright © 1998-2001 by Object Mentor, Inc
All Rights Reserved
The three modes of UML
Conceptual
Tied to human language.

Specification
A description of source code yet to be written.

Implementation
A description of source code that already exists.

2
Conceptual
Tied to human language:

Animal

“An Anima l ISA Dog”
Dog

3
Hmmm…

4
Tied to human language
A n im a l

Lounge
C h a ir

Led
Z e p p lin

5

« S it s I n A »

« D r in k s A »
Dog

« G ro o ve s T o »

M a r tin i

«S m okesA »
C ig a r

{W a yL o u d }
Models of the “Real World”
Do not relate to software structure.

Now it’s time for: Uncle Bob’s rant….
Human language is not the best foundation
for software structure.
A Circle ISA Ellipse.

6
A Circle ISA Ellipse
User

E llip s e

C ir c le

7
Specification and Implementation
Are tied to code.
Follow the same rules.
Differ only in detail.
Sometimes.

8
Example:
public class TreeMap {
TreeMapNode topNode = null;
public void add(Comparable key, Object value) {…}
public Object get(Comparable key) {…}
}
class TreeMapNode {
private Comparable itsKey;
private Object itsValue;
private TreeMapNode nodes[] = new TreeMapNode[2];
public TreeMapNode(Comparable key, Object value) {…}
public Object find(Comparable key) {…}
public void add(Comparable key, Object value) {…}
}

9
Here’s some UML for that.
2
TreeMap
+ add(key, value)
+ get(key)

topNode

nodes

TreeMapNode
+ add(key, value)
+ find(key)
itsKey

«interface»
Comparable

itsValue
Object

10
Classes and Relationships.
Rectangles represent classes, and arrows represent relationships.

2
TreeMap
+ add(key, value)
+ get(key)

topNode

nodes

TreeMapNode
+ add(key, value)
+ find(key)
itsKey

itsValue

11

«interface»
Comparable

Object
Associations.
In this diagram all the relationships are associations. Associations are
simple data relationships in which one object holds a reference to, and
invokes methods upon, the other.

2
TreeMap
+ add(key, value)
+ get(key)

topNode

nodes

TreeMapNode
+ add(key, value)
+ find(key)
itsKey

itsValue

12

«interface»
Comparable

Object
Relationship Names.
The name on an association maps to the name of the
variable that holds the reference.

public class TreeMap {
TreeMapNode topNode = null;
}
2
TreeMap
+ add(key, value)
+ get(key)

topNode

nodes

TreeMapNode
+ add(key, value)
+ find(key)
itsKey

itsValue

13

«interface»
Comparable

Object
Multiplicity.
A number next to an arrowhead typically shows the number of
instances held by the relationship. If that number is greater than
one then some kind of container, like an array, is implied.
class TreeMapNode {
private TreeMapNode nodes[] = new TreeMapNode[2];
}
2
TreeMap
+ add(key, value)
+ get(key)

topNode

nodes

TreeMapNode
+ add(key, value)
+ find(key)
itsKey

itsValue

14

«interface»
Comparable

Object
Class Icons.
Class icons can have more than one compartment. The top compartment
always holds the name of the class. The other compartments describe
functions and variables.

2
TreeMap
+ add(key, value)
+ get(key)

topNode

nodes

TreeMapNode
+ add(key, value)
+ find(key)
itsKey

itsValue

15

«interface»
Comparable

Object
Interface.
The «interface» notation means that Comparable is an interface.

2
TreeMap
+ add(key, value)
+ get(key)

topNode

nodes

TreeMapNode
+ add(key, value)
+ find(key)
itsKey

itsValue

16

«interface»
Comparable

Object
Optional.
Most of the notations shown are optional
Uncle Bob is going to ra nt a ga in…
2
TreeMap
+ add(key, value)
+ get(key)

topNode

nodes

TreeMapNode
+ add(key, value)
+ find(key)
itsKey

itsValue

17

«interface»
Comparable

Object
<<Grimace>>.
But Uncle Bob, you didn’t ta lk a bout
Aggre ga tion or Compos ition.
Ra nt….
C ar

E n g in e

18

S te e r in g
W heel
Object Diagrams.
:TreeMap

topNode
:TreeMapNode
- itsKey = "Martin"

nodes[LESS]

nodes[GREATER]

:TreeMapNode

:TreeMapNode

- itsKey = "Bob"

- itsKey = "Robin"

nodes[LESS]

nodes[LESS]

:TreeMapNode

:TreeMapNode

:TreeMapNode

:TreeMapNode

- itsKey = "Alan"

19

nodes[GREATER]

- itsKey = "Don"

- itsKey = "Paul"

- itsKey = "Sam"

nodes[GREATER]
Freeze Frame.
It shows a set of objects and relationships at a particular moment in the
execution of the system. You can view it as a snapshot of memory.

:TreeMap

topNode
:TreeMapNode
- itsKey = "Martin"

nodes[LESS]

nodes[GREATER]

:TreeMapNode

:TreeMapNode

- itsKey = "Bob"

- itsKey = "Robin"

nodes[LESS]

nodes[LESS]

:TreeMapNode

:TreeMapNode

:TreeMapNode

:TreeMapNode

- itsKey = "Alan"

20

nodes[GREATER]

- itsKey = "Don"

- itsKey = "Paul"

- itsKey = "Sam"

nodes[GREATER]
Object Names are Underlined.
the rectangle icons represent objects. You can tell that they are
objects because their names are underlined.

:TreeMap

topNode
:TreeMapNode
- itsKey = "Martin"

nodes[LESS]

nodes[GREATER]

:TreeMapNode

:TreeMapNode

- itsKey = "Bob"

- itsKey = "Robin"

nodes[LESS]

nodes[LESS]

:TreeMapNode

:TreeMapNode

:TreeMapNode

:TreeMapNode

- itsKey = "Alan"

21

nodes[GREATER]

- itsKey = "Don"

- itsKey = "Paul"

- itsKey = "Sam"

nodes[GREATER]
Object : Class
The name after the colon is the name of the
class that the object belongs to.
:TreeMap

topNode
:TreeMapNode
- itsKey = "Martin"

nodes[LESS]

nodes[GREATER]

:TreeMapNode

:TreeMapNode

- itsKey = "Bob"

- itsKey = "Robin"

nodes[LESS]

nodes[LESS]

:TreeMapNode

:TreeMapNode

:TreeMapNode

:TreeMapNode

- itsKey = "Alan"

22

nodes[GREATER]

- itsKey = "Don"

- itsKey = "Paul"

- itsKey = "Sam"

nodes[GREATER]
Values.
Note that the lower compartment of each object
shows the value of that object’s itsKey variable.
:TreeMap

topNode
:TreeMapNode
- itsKey = "Martin"

nodes[LESS]

nodes[GREATER]

:TreeMapNode

:TreeMapNode

- itsKey = "Bob"

- itsKey = "Robin"

nodes[LESS]

nodes[LESS]

:TreeMapNode

:TreeMapNode

:TreeMapNode

:TreeMapNode

- itsKey = "Alan"

23

nodes[GREATER]

- itsKey = "Don"

- itsKey = "Paul"

- itsKey = "Sam"

nodes[GREATER]
Links.
The relationships between the objects are called
links, and are derived from the associations.

:TreeMap
2
TreeMap
+ add(key, value)
+ get(key)

topNode

topNode

nodes

TreeMapNode

:TreeMapNode

+ add(key, value)
+ find(key)

- itsKey = "Martin"

itsKey

«interface»
Comparable

nodes[LESS]
itsValue

Object

nodes[GREATER]

:TreeMapNode

:TreeMapNode

- itsKey = "Bob"

- itsKey = "Robin"

nodes[LESS]

nodes[LESS]

:TreeMapNode

24

nodes[GREATER]
:TreeMapNode

:TreeMapNode

:TreeMapNode

- itsKey = "Alan"

- itsKey = "Don"

- itsKey = "Paul"

- itsKey = "Sam"

nodes[GREATER]
Sequence Diagrams.
public void add(Comparable key,Object value){
if (topNode == null)
topNode = new TreeMapNode(key, value);
else
topNode.add(key, value);
}
:TreeMap
add(key, value)

value

key

[topNode == null]

topNode:
TreeMapNode

add(key, value)

25

[topNode != null]
Actor.
The stick figure (actor) represents an
unknown caller.

:TreeMap
add(key, value)

value

key

[topNode == null]

topNode:
TreeMapNode

add(key, value)

26

[topNode != null]
Lifelines.
The dashed lines are lifelines, they
show the lifetime of the objects they
descend from.
:TreeMap
add(key, value)

value

key

[topNode == null]

topNode:
TreeMapNode

add(key, value)

27

[topNode != null]
Messages.
The long arrows are messages sent
between the objects.

:TreeMap
add(key, value)

value

key

[topNode == null]

topNode:
TreeMapNode

add(key, value)

28

[topNode != null]
Guards.
The boolean expressions inside square brackets are
called guards. They show which path is taken.

:TreeMap
add(key, value)

value

key

[topNode == null]

topNode:
TreeMapNode

add(key, value)

29

[topNode != null]
Construction.
The message arrow that terminates on the
TreeMapNode icon represents construction.

:TreeMap
add(key, value)

value

key

[topNode == null]

topNode:
TreeMapNode

add(key, value)

30

[topNode != null]
Data Tokens
The little arrows with circles are called data tokens.
They show any arguments or return values.

:TreeMap
add(key, value)

value

key

[topNode == null]

topNode:
TreeMapNode

add(key, value)

31

[topNode != null]
Activations.
The skinny rectangle below TreeMap is called
an activation. It depicts how much time the add
method executes.

:TreeMap
add(key, value)

value

key

[topNode == null]

topNode:
TreeMapNode

add(key, value)

32

[topNode != null]
Collaboration Diagrams.
1: add(key, value)
:TreeMap

[topNode != null]
1.1:add(key, value)
topNode
:TreeMapNode

33
Same data as Sequence Diagrams.
Collaboration diagrams make the
relationships between the objects clear.
1: add(key, value)
:TreeMap

[topNode != null]
1.1:add(key, value)
topNode
:TreeMapNode

34
Links (again).
The objects are connected by relationships called
links. A link exists wherever one object can send a
message to another.
1: add(key, value)
:TreeMap

[topNode != null]
1.1:add(key, value)
topNode
:TreeMapNode

35
Messages.
Traveling over those links are the messages
themselves. They are depicted as the smaller arrows.
1: add(key, value)
:TreeMap

[topNode != null]
1.1:add(key, value)
topNode
:TreeMapNode

36
Message Labels.
The messages are labeled with the name of
the message, its sequence number, and any
guards that apply.
1: add(key, value)
:TreeMap

[topNode != null]
1.1:add(key, value)
topNode
:TreeMapNode

37
Sequence Numbers.
The dot structure of the sequence number
shows the calling hierarchy.
1: add(key, value)
:TreeMap

[topNode != null]
1.1:add(key, value)
topNode
:TreeMapNode

38
State Diagrams.
A Subway Turnstile.

coin / Unlock
pass / Alarm

Locked

pass / Lock

39

Unlocked

coin / Thankyou
States.
There are two states named
Locked and Unlocked.

coin / Unlock
pass / Alarm

Locked

pass / Lock

40

Unlocked

coin / Thankyou
Events.
Two events may be sent to the machine.
The coin event means that the user has dropped a
coin into the turnstile.
The pass event means that the user has passed
through the turnstile.

coin / Unlock
pass / Alarm

Locked

pass / Lock

41

Unlocked

coin / Thankyou
Transitions.
The arrows are called transitions. They are labeled with
the event that triggers the transition and the action that
the transition performs.

coin / Unlock
pass / Alarm

Locked

pass / Lock

42

Unlocked

coin / Thankyou
Interpretation.
If we are in the Locked state and we get a coin event, then we transition to
the Unlocked state and we invoke the Unlock function.
If we are in the Unlocked state and we get a pass event, then we transition
to the Locked state and we invoke the Lock function.
If we are in the Unlocked state and we get a coin event, then we stay in the
Unlocked state and we call the Thankyou function.
If we are in the Locked state and we get a pass event, then we stay in the
Locked state and we call the Alarm function.

pass / Alarm

Locked

coin / Unlock

pass / Lock

43

Unlocked

coin / Thankyou
Sufficiency.
The diagrams shown in this chapter are enough
for most purposes.
Most programmers could live without any more
knowledge of UML that what is shown here.

44
Tools.
Now ask me what I think about tools…..

45
Documentation.

46
Where to get this presentation.

47

More Related Content

What's hot

First few months with Kotlin - Introduction through android examples
First few months with Kotlin - Introduction through android examplesFirst few months with Kotlin - Introduction through android examples
First few months with Kotlin - Introduction through android examplesNebojša Vukšić
 
Data Analysis and Programming in R
Data Analysis and Programming in RData Analysis and Programming in R
Data Analysis and Programming in REshwar Sai
 
Monads and Monoids by Oleksiy Dyagilev
Monads and Monoids by Oleksiy DyagilevMonads and Monoids by Oleksiy Dyagilev
Monads and Monoids by Oleksiy DyagilevJavaDayUA
 
DataFrame in Python Pandas
DataFrame in Python PandasDataFrame in Python Pandas
DataFrame in Python PandasSangita Panchal
 
Mysql Performance Optimization Indexing Algorithms and Data Structures
Mysql Performance Optimization Indexing Algorithms and Data StructuresMysql Performance Optimization Indexing Algorithms and Data Structures
Mysql Performance Optimization Indexing Algorithms and Data StructuresAbhijit Mondal
 
The Curious Clojurist - Neal Ford (Thoughtworks)
The Curious Clojurist - Neal Ford (Thoughtworks)The Curious Clojurist - Neal Ford (Thoughtworks)
The Curious Clojurist - Neal Ford (Thoughtworks)jaxLondonConference
 
R Workshop for Beginners
R Workshop for BeginnersR Workshop for Beginners
R Workshop for BeginnersMetamarkets
 
Data Visualization 2020_21
Data Visualization 2020_21Data Visualization 2020_21
Data Visualization 2020_21Sangita Panchal
 
Scala - en bedre og mere effektiv Java?
Scala - en bedre og mere effektiv Java?Scala - en bedre og mere effektiv Java?
Scala - en bedre og mere effektiv Java?Jesper Kamstrup Linnet
 
R programming intro with examples
R programming intro with examplesR programming intro with examples
R programming intro with examplesDennis
 
Useful functions for arrays in php
Useful functions for arrays in phpUseful functions for arrays in php
Useful functions for arrays in phpChetan Patel
 
Advanced geoprocessing with Python
Advanced geoprocessing with PythonAdvanced geoprocessing with Python
Advanced geoprocessing with PythonChad Cooper
 
CS101- Introduction to Computing- Lecture 38
CS101- Introduction to Computing- Lecture 38CS101- Introduction to Computing- Lecture 38
CS101- Introduction to Computing- Lecture 38Bilal Ahmed
 

What's hot (20)

R learning by examples
R learning by examplesR learning by examples
R learning by examples
 
First few months with Kotlin - Introduction through android examples
First few months with Kotlin - Introduction through android examplesFirst few months with Kotlin - Introduction through android examples
First few months with Kotlin - Introduction through android examples
 
Python : Dictionaries
Python : DictionariesPython : Dictionaries
Python : Dictionaries
 
Pandas Series
Pandas SeriesPandas Series
Pandas Series
 
Data Analysis and Programming in R
Data Analysis and Programming in RData Analysis and Programming in R
Data Analysis and Programming in R
 
Monads and Monoids by Oleksiy Dyagilev
Monads and Monoids by Oleksiy DyagilevMonads and Monoids by Oleksiy Dyagilev
Monads and Monoids by Oleksiy Dyagilev
 
DataFrame in Python Pandas
DataFrame in Python PandasDataFrame in Python Pandas
DataFrame in Python Pandas
 
Mysql Performance Optimization Indexing Algorithms and Data Structures
Mysql Performance Optimization Indexing Algorithms and Data StructuresMysql Performance Optimization Indexing Algorithms and Data Structures
Mysql Performance Optimization Indexing Algorithms and Data Structures
 
The Curious Clojurist - Neal Ford (Thoughtworks)
The Curious Clojurist - Neal Ford (Thoughtworks)The Curious Clojurist - Neal Ford (Thoughtworks)
The Curious Clojurist - Neal Ford (Thoughtworks)
 
R Workshop for Beginners
R Workshop for BeginnersR Workshop for Beginners
R Workshop for Beginners
 
Data Visualization 2020_21
Data Visualization 2020_21Data Visualization 2020_21
Data Visualization 2020_21
 
Scala - en bedre og mere effektiv Java?
Scala - en bedre og mere effektiv Java?Scala - en bedre og mere effektiv Java?
Scala - en bedre og mere effektiv Java?
 
R basics
R basicsR basics
R basics
 
R programming intro with examples
R programming intro with examplesR programming intro with examples
R programming intro with examples
 
Scala best practices
Scala best practicesScala best practices
Scala best practices
 
Useful functions for arrays in php
Useful functions for arrays in phpUseful functions for arrays in php
Useful functions for arrays in php
 
Advanced geoprocessing with Python
Advanced geoprocessing with PythonAdvanced geoprocessing with Python
Advanced geoprocessing with Python
 
Python programming : Strings
Python programming : StringsPython programming : Strings
Python programming : Strings
 
Python programming : Standard Input and Output
Python programming : Standard Input and OutputPython programming : Standard Input and Output
Python programming : Standard Input and Output
 
CS101- Introduction to Computing- Lecture 38
CS101- Introduction to Computing- Lecture 38CS101- Introduction to Computing- Lecture 38
CS101- Introduction to Computing- Lecture 38
 

Similar to UML for Java Programmers - Conceptual, Specification, and Implementation Modes Explained

The Ring programming language version 1.7 book - Part 41 of 196
The Ring programming language version 1.7 book - Part 41 of 196The Ring programming language version 1.7 book - Part 41 of 196
The Ring programming language version 1.7 book - Part 41 of 196Mahmoud Samir Fayed
 
Beginning-Scala-Options-Either-Try.pdf
Beginning-Scala-Options-Either-Try.pdfBeginning-Scala-Options-Either-Try.pdf
Beginning-Scala-Options-Either-Try.pdfOvidiuEremia2
 
C# Summer course - Lecture 2
C# Summer course - Lecture 2C# Summer course - Lecture 2
C# Summer course - Lecture 2mohamedsamyali
 
Dancing Links: an educational pearl
Dancing Links: an educational pearlDancing Links: an educational pearl
Dancing Links: an educational pearlESUG
 
The Ring programming language version 1.6 book - Part 32 of 189
The Ring programming language version 1.6 book - Part 32 of 189The Ring programming language version 1.6 book - Part 32 of 189
The Ring programming language version 1.6 book - Part 32 of 189Mahmoud Samir Fayed
 
Declarative Thinking, Declarative Practice
Declarative Thinking, Declarative PracticeDeclarative Thinking, Declarative Practice
Declarative Thinking, Declarative PracticeKevlin Henney
 
Class & Object - Intro
Class & Object - IntroClass & Object - Intro
Class & Object - IntroPRN USM
 
The Ring programming language version 1.2 book - Part 19 of 84
The Ring programming language version 1.2 book - Part 19 of 84The Ring programming language version 1.2 book - Part 19 of 84
The Ring programming language version 1.2 book - Part 19 of 84Mahmoud Samir Fayed
 
PPT on Data Science Using Python
PPT on Data Science Using PythonPPT on Data Science Using Python
PPT on Data Science Using PythonNishantKumar1179
 
Python High Level Functions_Ch 11.ppt
Python High Level Functions_Ch 11.pptPython High Level Functions_Ch 11.ppt
Python High Level Functions_Ch 11.pptAnishaJ7
 
Python Workshop - Learn Python the Hard Way
Python Workshop - Learn Python the Hard WayPython Workshop - Learn Python the Hard Way
Python Workshop - Learn Python the Hard WayUtkarsh Sengar
 
The Ring programming language version 1.8 book - Part 94 of 202
The Ring programming language version 1.8 book - Part 94 of 202The Ring programming language version 1.8 book - Part 94 of 202
The Ring programming language version 1.8 book - Part 94 of 202Mahmoud Samir Fayed
 
Introduction to matlab lecture 1 of 4
Introduction to matlab lecture 1 of 4Introduction to matlab lecture 1 of 4
Introduction to matlab lecture 1 of 4Randa Elanwar
 

Similar to UML for Java Programmers - Conceptual, Specification, and Implementation Modes Explained (20)

The Ring programming language version 1.7 book - Part 41 of 196
The Ring programming language version 1.7 book - Part 41 of 196The Ring programming language version 1.7 book - Part 41 of 196
The Ring programming language version 1.7 book - Part 41 of 196
 
Beginning-Scala-Options-Either-Try.pdf
Beginning-Scala-Options-Either-Try.pdfBeginning-Scala-Options-Either-Try.pdf
Beginning-Scala-Options-Either-Try.pdf
 
MongoDB
MongoDB MongoDB
MongoDB
 
C# Summer course - Lecture 2
C# Summer course - Lecture 2C# Summer course - Lecture 2
C# Summer course - Lecture 2
 
Structure Arrays
Structure ArraysStructure Arrays
Structure Arrays
 
Dancing Links: an educational pearl
Dancing Links: an educational pearlDancing Links: an educational pearl
Dancing Links: an educational pearl
 
Computer project
Computer projectComputer project
Computer project
 
Lecture 9.pptx
Lecture 9.pptxLecture 9.pptx
Lecture 9.pptx
 
The Ring programming language version 1.6 book - Part 32 of 189
The Ring programming language version 1.6 book - Part 32 of 189The Ring programming language version 1.6 book - Part 32 of 189
The Ring programming language version 1.6 book - Part 32 of 189
 
Declarative Thinking, Declarative Practice
Declarative Thinking, Declarative PracticeDeclarative Thinking, Declarative Practice
Declarative Thinking, Declarative Practice
 
Class & Object - Intro
Class & Object - IntroClass & Object - Intro
Class & Object - Intro
 
Introduction to r
Introduction to rIntroduction to r
Introduction to r
 
The Ring programming language version 1.2 book - Part 19 of 84
The Ring programming language version 1.2 book - Part 19 of 84The Ring programming language version 1.2 book - Part 19 of 84
The Ring programming language version 1.2 book - Part 19 of 84
 
PPT on Data Science Using Python
PPT on Data Science Using PythonPPT on Data Science Using Python
PPT on Data Science Using Python
 
Python High Level Functions_Ch 11.ppt
Python High Level Functions_Ch 11.pptPython High Level Functions_Ch 11.ppt
Python High Level Functions_Ch 11.ppt
 
Python Workshop - Learn Python the Hard Way
Python Workshop - Learn Python the Hard WayPython Workshop - Learn Python the Hard Way
Python Workshop - Learn Python the Hard Way
 
The Ring programming language version 1.8 book - Part 94 of 202
The Ring programming language version 1.8 book - Part 94 of 202The Ring programming language version 1.8 book - Part 94 of 202
The Ring programming language version 1.8 book - Part 94 of 202
 
interenship.pptx
interenship.pptxinterenship.pptx
interenship.pptx
 
Introduction to matlab lecture 1 of 4
Introduction to matlab lecture 1 of 4Introduction to matlab lecture 1 of 4
Introduction to matlab lecture 1 of 4
 
R environment
R environmentR environment
R environment
 

More from QUAID-E-AWAM UNIVERSITY OF ENGINEERING, SCIENCE & TECHNOLOGY, NAWABSHAH, SINDH, PAKISTAN (11)

Introduction to Java Programming
Introduction to Java ProgrammingIntroduction to Java Programming
Introduction to Java Programming
 
Java tutorials
Java tutorialsJava tutorials
Java tutorials
 
Java
JavaJava
Java
 
Java
JavaJava
Java
 
Java
JavaJava
Java
 
Java multi thread programming on cmp system
Java multi thread programming on cmp systemJava multi thread programming on cmp system
Java multi thread programming on cmp system
 
Java applets
Java appletsJava applets
Java applets
 
Introduction to-java
Introduction to-javaIntroduction to-java
Introduction to-java
 
Introduction+to+java+2
Introduction+to+java+2Introduction+to+java+2
Introduction+to+java+2
 
Introduction to matlab
Introduction to matlabIntroduction to matlab
Introduction to matlab
 
Threads
ThreadsThreads
Threads
 

Recently uploaded

Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
 
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxGrade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxChelloAnnAsuncion2
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfSpandanaRallapalli
 
AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.arsicmarija21
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxDr.Ibrahim Hassaan
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxEyham Joco
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Mark Reed
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Jisc
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
ROOT CAUSE ANALYSIS PowerPoint Presentation
ROOT CAUSE ANALYSIS PowerPoint PresentationROOT CAUSE ANALYSIS PowerPoint Presentation
ROOT CAUSE ANALYSIS PowerPoint PresentationAadityaSharma884161
 

Recently uploaded (20)

Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxGrade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdf
 
AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptx
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptx
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
Raw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptxRaw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptx
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
ROOT CAUSE ANALYSIS PowerPoint Presentation
ROOT CAUSE ANALYSIS PowerPoint PresentationROOT CAUSE ANALYSIS PowerPoint Presentation
ROOT CAUSE ANALYSIS PowerPoint Presentation
 

UML for Java Programmers - Conceptual, Specification, and Implementation Modes Explained

  • 1. UML for Java Programmers Object Mentor, Inc. Or How Uncle Bob us e s UML. www.objectmentor.com fitnesse.org www.xprogramming www.junit.org Copyright © 1998-2001 by Object Mentor, Inc All Rights Reserved
  • 2. The three modes of UML Conceptual Tied to human language. Specification A description of source code yet to be written. Implementation A description of source code that already exists. 2
  • 3. Conceptual Tied to human language: Animal “An Anima l ISA Dog” Dog 3
  • 5. Tied to human language A n im a l Lounge C h a ir Led Z e p p lin 5 « S it s I n A » « D r in k s A » Dog « G ro o ve s T o » M a r tin i «S m okesA » C ig a r {W a yL o u d }
  • 6. Models of the “Real World” Do not relate to software structure. Now it’s time for: Uncle Bob’s rant…. Human language is not the best foundation for software structure. A Circle ISA Ellipse. 6
  • 7. A Circle ISA Ellipse User E llip s e C ir c le 7
  • 8. Specification and Implementation Are tied to code. Follow the same rules. Differ only in detail. Sometimes. 8
  • 9. Example: public class TreeMap { TreeMapNode topNode = null; public void add(Comparable key, Object value) {…} public Object get(Comparable key) {…} } class TreeMapNode { private Comparable itsKey; private Object itsValue; private TreeMapNode nodes[] = new TreeMapNode[2]; public TreeMapNode(Comparable key, Object value) {…} public Object find(Comparable key) {…} public void add(Comparable key, Object value) {…} } 9
  • 10. Here’s some UML for that. 2 TreeMap + add(key, value) + get(key) topNode nodes TreeMapNode + add(key, value) + find(key) itsKey «interface» Comparable itsValue Object 10
  • 11. Classes and Relationships. Rectangles represent classes, and arrows represent relationships. 2 TreeMap + add(key, value) + get(key) topNode nodes TreeMapNode + add(key, value) + find(key) itsKey itsValue 11 «interface» Comparable Object
  • 12. Associations. In this diagram all the relationships are associations. Associations are simple data relationships in which one object holds a reference to, and invokes methods upon, the other. 2 TreeMap + add(key, value) + get(key) topNode nodes TreeMapNode + add(key, value) + find(key) itsKey itsValue 12 «interface» Comparable Object
  • 13. Relationship Names. The name on an association maps to the name of the variable that holds the reference. public class TreeMap { TreeMapNode topNode = null; } 2 TreeMap + add(key, value) + get(key) topNode nodes TreeMapNode + add(key, value) + find(key) itsKey itsValue 13 «interface» Comparable Object
  • 14. Multiplicity. A number next to an arrowhead typically shows the number of instances held by the relationship. If that number is greater than one then some kind of container, like an array, is implied. class TreeMapNode { private TreeMapNode nodes[] = new TreeMapNode[2]; } 2 TreeMap + add(key, value) + get(key) topNode nodes TreeMapNode + add(key, value) + find(key) itsKey itsValue 14 «interface» Comparable Object
  • 15. Class Icons. Class icons can have more than one compartment. The top compartment always holds the name of the class. The other compartments describe functions and variables. 2 TreeMap + add(key, value) + get(key) topNode nodes TreeMapNode + add(key, value) + find(key) itsKey itsValue 15 «interface» Comparable Object
  • 16. Interface. The «interface» notation means that Comparable is an interface. 2 TreeMap + add(key, value) + get(key) topNode nodes TreeMapNode + add(key, value) + find(key) itsKey itsValue 16 «interface» Comparable Object
  • 17. Optional. Most of the notations shown are optional Uncle Bob is going to ra nt a ga in… 2 TreeMap + add(key, value) + get(key) topNode nodes TreeMapNode + add(key, value) + find(key) itsKey itsValue 17 «interface» Comparable Object
  • 18. <<Grimace>>. But Uncle Bob, you didn’t ta lk a bout Aggre ga tion or Compos ition. Ra nt…. C ar E n g in e 18 S te e r in g W heel
  • 19. Object Diagrams. :TreeMap topNode :TreeMapNode - itsKey = "Martin" nodes[LESS] nodes[GREATER] :TreeMapNode :TreeMapNode - itsKey = "Bob" - itsKey = "Robin" nodes[LESS] nodes[LESS] :TreeMapNode :TreeMapNode :TreeMapNode :TreeMapNode - itsKey = "Alan" 19 nodes[GREATER] - itsKey = "Don" - itsKey = "Paul" - itsKey = "Sam" nodes[GREATER]
  • 20. Freeze Frame. It shows a set of objects and relationships at a particular moment in the execution of the system. You can view it as a snapshot of memory. :TreeMap topNode :TreeMapNode - itsKey = "Martin" nodes[LESS] nodes[GREATER] :TreeMapNode :TreeMapNode - itsKey = "Bob" - itsKey = "Robin" nodes[LESS] nodes[LESS] :TreeMapNode :TreeMapNode :TreeMapNode :TreeMapNode - itsKey = "Alan" 20 nodes[GREATER] - itsKey = "Don" - itsKey = "Paul" - itsKey = "Sam" nodes[GREATER]
  • 21. Object Names are Underlined. the rectangle icons represent objects. You can tell that they are objects because their names are underlined. :TreeMap topNode :TreeMapNode - itsKey = "Martin" nodes[LESS] nodes[GREATER] :TreeMapNode :TreeMapNode - itsKey = "Bob" - itsKey = "Robin" nodes[LESS] nodes[LESS] :TreeMapNode :TreeMapNode :TreeMapNode :TreeMapNode - itsKey = "Alan" 21 nodes[GREATER] - itsKey = "Don" - itsKey = "Paul" - itsKey = "Sam" nodes[GREATER]
  • 22. Object : Class The name after the colon is the name of the class that the object belongs to. :TreeMap topNode :TreeMapNode - itsKey = "Martin" nodes[LESS] nodes[GREATER] :TreeMapNode :TreeMapNode - itsKey = "Bob" - itsKey = "Robin" nodes[LESS] nodes[LESS] :TreeMapNode :TreeMapNode :TreeMapNode :TreeMapNode - itsKey = "Alan" 22 nodes[GREATER] - itsKey = "Don" - itsKey = "Paul" - itsKey = "Sam" nodes[GREATER]
  • 23. Values. Note that the lower compartment of each object shows the value of that object’s itsKey variable. :TreeMap topNode :TreeMapNode - itsKey = "Martin" nodes[LESS] nodes[GREATER] :TreeMapNode :TreeMapNode - itsKey = "Bob" - itsKey = "Robin" nodes[LESS] nodes[LESS] :TreeMapNode :TreeMapNode :TreeMapNode :TreeMapNode - itsKey = "Alan" 23 nodes[GREATER] - itsKey = "Don" - itsKey = "Paul" - itsKey = "Sam" nodes[GREATER]
  • 24. Links. The relationships between the objects are called links, and are derived from the associations. :TreeMap 2 TreeMap + add(key, value) + get(key) topNode topNode nodes TreeMapNode :TreeMapNode + add(key, value) + find(key) - itsKey = "Martin" itsKey «interface» Comparable nodes[LESS] itsValue Object nodes[GREATER] :TreeMapNode :TreeMapNode - itsKey = "Bob" - itsKey = "Robin" nodes[LESS] nodes[LESS] :TreeMapNode 24 nodes[GREATER] :TreeMapNode :TreeMapNode :TreeMapNode - itsKey = "Alan" - itsKey = "Don" - itsKey = "Paul" - itsKey = "Sam" nodes[GREATER]
  • 25. Sequence Diagrams. public void add(Comparable key,Object value){ if (topNode == null) topNode = new TreeMapNode(key, value); else topNode.add(key, value); } :TreeMap add(key, value) value key [topNode == null] topNode: TreeMapNode add(key, value) 25 [topNode != null]
  • 26. Actor. The stick figure (actor) represents an unknown caller. :TreeMap add(key, value) value key [topNode == null] topNode: TreeMapNode add(key, value) 26 [topNode != null]
  • 27. Lifelines. The dashed lines are lifelines, they show the lifetime of the objects they descend from. :TreeMap add(key, value) value key [topNode == null] topNode: TreeMapNode add(key, value) 27 [topNode != null]
  • 28. Messages. The long arrows are messages sent between the objects. :TreeMap add(key, value) value key [topNode == null] topNode: TreeMapNode add(key, value) 28 [topNode != null]
  • 29. Guards. The boolean expressions inside square brackets are called guards. They show which path is taken. :TreeMap add(key, value) value key [topNode == null] topNode: TreeMapNode add(key, value) 29 [topNode != null]
  • 30. Construction. The message arrow that terminates on the TreeMapNode icon represents construction. :TreeMap add(key, value) value key [topNode == null] topNode: TreeMapNode add(key, value) 30 [topNode != null]
  • 31. Data Tokens The little arrows with circles are called data tokens. They show any arguments or return values. :TreeMap add(key, value) value key [topNode == null] topNode: TreeMapNode add(key, value) 31 [topNode != null]
  • 32. Activations. The skinny rectangle below TreeMap is called an activation. It depicts how much time the add method executes. :TreeMap add(key, value) value key [topNode == null] topNode: TreeMapNode add(key, value) 32 [topNode != null]
  • 33. Collaboration Diagrams. 1: add(key, value) :TreeMap [topNode != null] 1.1:add(key, value) topNode :TreeMapNode 33
  • 34. Same data as Sequence Diagrams. Collaboration diagrams make the relationships between the objects clear. 1: add(key, value) :TreeMap [topNode != null] 1.1:add(key, value) topNode :TreeMapNode 34
  • 35. Links (again). The objects are connected by relationships called links. A link exists wherever one object can send a message to another. 1: add(key, value) :TreeMap [topNode != null] 1.1:add(key, value) topNode :TreeMapNode 35
  • 36. Messages. Traveling over those links are the messages themselves. They are depicted as the smaller arrows. 1: add(key, value) :TreeMap [topNode != null] 1.1:add(key, value) topNode :TreeMapNode 36
  • 37. Message Labels. The messages are labeled with the name of the message, its sequence number, and any guards that apply. 1: add(key, value) :TreeMap [topNode != null] 1.1:add(key, value) topNode :TreeMapNode 37
  • 38. Sequence Numbers. The dot structure of the sequence number shows the calling hierarchy. 1: add(key, value) :TreeMap [topNode != null] 1.1:add(key, value) topNode :TreeMapNode 38
  • 39. State Diagrams. A Subway Turnstile. coin / Unlock pass / Alarm Locked pass / Lock 39 Unlocked coin / Thankyou
  • 40. States. There are two states named Locked and Unlocked. coin / Unlock pass / Alarm Locked pass / Lock 40 Unlocked coin / Thankyou
  • 41. Events. Two events may be sent to the machine. The coin event means that the user has dropped a coin into the turnstile. The pass event means that the user has passed through the turnstile. coin / Unlock pass / Alarm Locked pass / Lock 41 Unlocked coin / Thankyou
  • 42. Transitions. The arrows are called transitions. They are labeled with the event that triggers the transition and the action that the transition performs. coin / Unlock pass / Alarm Locked pass / Lock 42 Unlocked coin / Thankyou
  • 43. Interpretation. If we are in the Locked state and we get a coin event, then we transition to the Unlocked state and we invoke the Unlock function. If we are in the Unlocked state and we get a pass event, then we transition to the Locked state and we invoke the Lock function. If we are in the Unlocked state and we get a coin event, then we stay in the Unlocked state and we call the Thankyou function. If we are in the Locked state and we get a pass event, then we stay in the Locked state and we call the Alarm function. pass / Alarm Locked coin / Unlock pass / Lock 43 Unlocked coin / Thankyou
  • 44. Sufficiency. The diagrams shown in this chapter are enough for most purposes. Most programmers could live without any more knowledge of UML that what is shown here. 44
  • 45. Tools. Now ask me what I think about tools….. 45
  • 47. Where to get this presentation. 47