introduction to uml. what is uml uml stands for unified modelling language a way to talk about...
TRANSCRIPT
![Page 1: Introduction to UML. What is UML UML stands for Unified Modelling Language A way to talk about Object Oriented Design UML is a visual language](https://reader035.vdocuments.mx/reader035/viewer/2022062620/551ba1a6550346167e8b5a97/html5/thumbnails/1.jpg)
Introduction to UML
![Page 2: Introduction to UML. What is UML UML stands for Unified Modelling Language A way to talk about Object Oriented Design UML is a visual language](https://reader035.vdocuments.mx/reader035/viewer/2022062620/551ba1a6550346167e8b5a97/html5/thumbnails/2.jpg)
What is UML
UML stands for Unified Modelling Language
A way to talk about Object Oriented Design
UML is a visual language
![Page 3: Introduction to UML. What is UML UML stands for Unified Modelling Language A way to talk about Object Oriented Design UML is a visual language](https://reader035.vdocuments.mx/reader035/viewer/2022062620/551ba1a6550346167e8b5a97/html5/thumbnails/3.jpg)
first second third
class :
attribute :
value :
instance :Colour
hue
"blue"
name : second
![Page 4: Introduction to UML. What is UML UML stands for Unified Modelling Language A way to talk about Object Oriented Design UML is a visual language](https://reader035.vdocuments.mx/reader035/viewer/2022062620/551ba1a6550346167e8b5a97/html5/thumbnails/4.jpg)
first second third
Colour
hue : String
"red"
"blue"
"green"
first : Colour
hue : "red"
second : Colour
hue : "blue"
third : Colour
hue : "green"
Class (UML)
instance(UML)
actual instance
![Page 5: Introduction to UML. What is UML UML stands for Unified Modelling Language A way to talk about Object Oriented Design UML is a visual language](https://reader035.vdocuments.mx/reader035/viewer/2022062620/551ba1a6550346167e8b5a97/html5/thumbnails/5.jpg)
shape1 shape2 shape3
Shape
form : String
setShape( String)
shape1 : Shape
form = "triangle"
shape2 : Shape
form = "rectangle"
shape3 : Shape
form = "pentagon"
![Page 6: Introduction to UML. What is UML UML stands for Unified Modelling Language A way to talk about Object Oriented Design UML is a visual language](https://reader035.vdocuments.mx/reader035/viewer/2022062620/551ba1a6550346167e8b5a97/html5/thumbnails/6.jpg)
shape1 shape2 shape3
Shape
form : String
setShape( String)
shape3 : Shape
form = "pentagon"
shape3.setShape("hexagon")
form = "hexagon"
![Page 7: Introduction to UML. What is UML UML stands for Unified Modelling Language A way to talk about Object Oriented Design UML is a visual language](https://reader035.vdocuments.mx/reader035/viewer/2022062620/551ba1a6550346167e8b5a97/html5/thumbnails/7.jpg)
shape1 shape2 shape3
ColouredShape
hue : String form : String
setHue( String) setShape( String)
shape1 : ColouredShape
hue = "blue"form = "triangle"
Attributes
methodsState of an instance is the values held in its attributes
![Page 8: Introduction to UML. What is UML UML stands for Unified Modelling Language A way to talk about Object Oriented Design UML is a visual language](https://reader035.vdocuments.mx/reader035/viewer/2022062620/551ba1a6550346167e8b5a97/html5/thumbnails/8.jpg)
shape1 shape2 shape3
shape1 : ColouredShape
hue = "blue"form = "triangle"
shape3 : ColouredShape
hue = "green"form = "hexagon"
shape1.setHue("red")
shape1 : ColouredShape
hue = "red"form = "triangle"
shape3.setShape("octagon")
shape3 : ColouredShape
hue = "green"form = "octagon"
![Page 9: Introduction to UML. What is UML UML stands for Unified Modelling Language A way to talk about Object Oriented Design UML is a visual language](https://reader035.vdocuments.mx/reader035/viewer/2022062620/551ba1a6550346167e8b5a97/html5/thumbnails/9.jpg)
Exercise 1
A hospital bed
attributes
methods
ward
bedNumber
occupied
patient
getBedNumber( ) : intgetWard( ) :String
getPatient ( ) : PatientisOccupied( ) : boolean
empty( )fill( Patient )
typesString
integer
boolean
Patient
List all the attributes you can think of for a hospital bed
For each attribute write down the type of the value
List all the methods you can think of for a hospital bed
![Page 10: Introduction to UML. What is UML UML stands for Unified Modelling Language A way to talk about Object Oriented Design UML is a visual language](https://reader035.vdocuments.mx/reader035/viewer/2022062620/551ba1a6550346167e8b5a97/html5/thumbnails/10.jpg)
Exercise 1
Draw a class diagram for a HospitalBed
![Page 11: Introduction to UML. What is UML UML stands for Unified Modelling Language A way to talk about Object Oriented Design UML is a visual language](https://reader035.vdocuments.mx/reader035/viewer/2022062620/551ba1a6550346167e8b5a97/html5/thumbnails/11.jpg)
HospitalBed
ward : StringbedNumber : integeroccupied : booleanpatient : Patient
getWard() :StringgetBedNumber():integerisOccupied() :booleangetPatient() :Patientempty()fill( Patient)
![Page 12: Introduction to UML. What is UML UML stands for Unified Modelling Language A way to talk about Object Oriented Design UML is a visual language](https://reader035.vdocuments.mx/reader035/viewer/2022062620/551ba1a6550346167e8b5a97/html5/thumbnails/12.jpg)
HospitalBed
ward : StringbedNumber : integeroccupied : booleanpatient : Patient
getWard():StringgetBedNumber():integerisOccupied():booleangetPatient():Patientempty()fill( Patient)
fred
CurrentBed:HospitalBed
ward : "Iris"bedNumber : 14occupied : TRUEpatient : fred
«instance of»
![Page 13: Introduction to UML. What is UML UML stands for Unified Modelling Language A way to talk about Object Oriented Design UML is a visual language](https://reader035.vdocuments.mx/reader035/viewer/2022062620/551ba1a6550346167e8b5a97/html5/thumbnails/13.jpg)
Exercise 1
Patient
Write down attributes fora patient
attributespatientID
name
address
bedNumber
ward
dateOfAdmission
DoB
consultant
notes
typesString
String
String
integer
String
Date
Date
Doctor
Notes...and their types
bed Bed
![Page 14: Introduction to UML. What is UML UML stands for Unified Modelling Language A way to talk about Object Oriented Design UML is a visual language](https://reader035.vdocuments.mx/reader035/viewer/2022062620/551ba1a6550346167e8b5a97/html5/thumbnails/14.jpg)
typical Patient instance
freddy : Patient
name = "Fred Smith"address = "14 Penny Lane"DOB = (07/12/1962)PatientID = "CM897DT"Bed = ("Rose",17)dateOfAdmission = (15/9/2003)consultant=(32331, "Dr A Dass", "Oncology")notes = (File: 2877738)
![Page 15: Introduction to UML. What is UML UML stands for Unified Modelling Language A way to talk about Object Oriented Design UML is a visual language](https://reader035.vdocuments.mx/reader035/viewer/2022062620/551ba1a6550346167e8b5a97/html5/thumbnails/15.jpg)
Extension
![Page 16: Introduction to UML. What is UML UML stands for Unified Modelling Language A way to talk about Object Oriented Design UML is a visual language](https://reader035.vdocuments.mx/reader035/viewer/2022062620/551ba1a6550346167e8b5a97/html5/thumbnails/16.jpg)
Exercise 2
Draw a class diagram for a Bank account
BankAccountaccountNumber: StringaccountName : Stringbalance : double
deposit( amount : double)withdraw(amount : double)
getAccountNumber():String
getBalance():doublegetAccountName():String
![Page 17: Introduction to UML. What is UML UML stands for Unified Modelling Language A way to talk about Object Oriented Design UML is a visual language](https://reader035.vdocuments.mx/reader035/viewer/2022062620/551ba1a6550346167e8b5a97/html5/thumbnails/17.jpg)
BankAccountaccountNumber: StringaccountName : Stringbalance : double
deposit( amount: double)withdraw( amount: double)getAccountNumber():StringgetAccountName():StringgetBalance():double
first : BankAccount
accountNumber: "123212"accountName : "Fred"balance : 1029.34
second : BankAccount
accountNumber: "786348"accountName : "Harry"balance : 1.77
third : BankAccount
accountNumber: "498101"accountName : "Asif"balance : 1102.95
fourth : BankAccount
accountNumber: "858838"accountName : "Hans"balance : -7.34
fifth : BankAccount
accountNumber: "573562"accountName : "Nadine"balance : 20351.12 Instances of the class BankAccount
![Page 18: Introduction to UML. What is UML UML stands for Unified Modelling Language A way to talk about Object Oriented Design UML is a visual language](https://reader035.vdocuments.mx/reader035/viewer/2022062620/551ba1a6550346167e8b5a97/html5/thumbnails/18.jpg)
Exercise 3Draw a class diagram for a Rectangle. The methods include finding the area and perimeter of the rectangle
Rectangle
height : doublewidth : doublearea(): doubleperimeter(): doublegetHeight(): doublegetWidth(): doublesetHeight( aHeight: double)setWidth( aWidth: double)
![Page 19: Introduction to UML. What is UML UML stands for Unified Modelling Language A way to talk about Object Oriented Design UML is a visual language](https://reader035.vdocuments.mx/reader035/viewer/2022062620/551ba1a6550346167e8b5a97/html5/thumbnails/19.jpg)
Exercise 4Write a class diagram for an item stored in a warehouse( ignore methods)
Item
itemNo : Stringdescription : StringitemCost : doublenumberInStock : integerreorderLevel : integerrow : integerbay : integerlevel : integer
Problem: If no item in a location in the warehouse, there is nothing recording the state of that location.
![Page 20: Introduction to UML. What is UML UML stands for Unified Modelling Language A way to talk about Object Oriented Design UML is a visual language](https://reader035.vdocuments.mx/reader035/viewer/2022062620/551ba1a6550346167e8b5a97/html5/thumbnails/20.jpg)
Exercise 4
Item Location0..1 1
itemNo : Stringdescription : StringitemCost : doublenumberInStock : integerreorderLevel : integer
row : integerbay : integerlevel : integer
Item Location
If the system was also used to create a catalogue, an item not held in stock cannot appear in the catalogue!
... much later ...
![Page 21: Introduction to UML. What is UML UML stands for Unified Modelling Language A way to talk about Object Oriented Design UML is a visual language](https://reader035.vdocuments.mx/reader035/viewer/2022062620/551ba1a6550346167e8b5a97/html5/thumbnails/21.jpg)
CatalogueItem
itemNo : Stringdescription : StringitemCost : double
Item
numberInStock : integerreorderLevel : integerisOrdered : boolean
Box
numberPerBox: integerboxIdNo : String
Location
row : integerbay : integerlevel : integerWareHouse
Catalogue1*
1
0..1
1*
1
*
*1
![Page 22: Introduction to UML. What is UML UML stands for Unified Modelling Language A way to talk about Object Oriented Design UML is a visual language](https://reader035.vdocuments.mx/reader035/viewer/2022062620/551ba1a6550346167e8b5a97/html5/thumbnails/22.jpg)
Exercise 5
A system keeps track of the arrivals and departures of aircraft at any airport for an airline.
Identify classes and attributes that might be used by the system
FlightTimeDate
FromLocationDestinationFlightNumber
more?
![Page 23: Introduction to UML. What is UML UML stands for Unified Modelling Language A way to talk about Object Oriented Design UML is a visual language](https://reader035.vdocuments.mx/reader035/viewer/2022062620/551ba1a6550346167e8b5a97/html5/thumbnails/23.jpg)
Exercise 5
A system keeps track of the arrivals and departures of aircraft at any airport for an airline.
Identify classes and attributes that might be used by the system
Flight
Time Date
fromtonumber
hoursminutesseconds
yearmonthday
![Page 24: Introduction to UML. What is UML UML stands for Unified Modelling Language A way to talk about Object Oriented Design UML is a visual language](https://reader035.vdocuments.mx/reader035/viewer/2022062620/551ba1a6550346167e8b5a97/html5/thumbnails/24.jpg)
Exercise 5
Flightnumbertime : Timedate : Date
Departureto: String
Arrivalfrom: String
![Page 25: Introduction to UML. What is UML UML stands for Unified Modelling Language A way to talk about Object Oriented Design UML is a visual language](https://reader035.vdocuments.mx/reader035/viewer/2022062620/551ba1a6550346167e8b5a97/html5/thumbnails/25.jpg)
...