Presentation is loading. Please wait.

Presentation is loading. Please wait.

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.

Similar presentations


Presentation on theme: "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."— Presentation transcript:

1 Introduction to UML

2 What is UML UML stands for Unified Modelling Language A way to talk about Object Oriented Design UML is a visual language

3 firstsecondthird class : attribute : value : instance : Colour hue "blue" name :second

4 firstsecondthird Colour hue : String "red" "blue" "green" first : Colour hue : "red" second : Colour hue : "blue" third : Colour hue : "green" Class (UML) instance(UML) actual instance

5 shape1shape2shape3 Shape form : String setShape( String) shape1 : Shape form = "triangle" shape2 : Shape form = "rectangle" shape3 : Shape form = "pentagon"

6 shape1shape2shape3 Shape form : String setShape( String) shape3 : Shape form = "pentagon" shape3.setShape("hexagon") form = "hexagon"

7 shape1shape2shape3 ColouredShape hue : String form : String setHue( String) setShape( String) shape1 : ColouredShape hue = "blue" form = "triangle" Attributes methods State of an instance is the values held in its attributes

8 shape1shape2shape3 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"

9 Exercise 1 A hospital bed attributes methods ward bedNumber occupied patient getBedNumber( ) : int getWard( ) :String getPatient ( ) : Patient isOccupied( ) : boolean empty( ) fill( Patient ) types String 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

10 Exercise 1 Draw a class diagram for a HospitalBed

11 HospitalBed ward : String bedNumber : integer occupied : boolean patient : Patient getWard() :String getBedNumber():integer isOccupied() :boolean getPatient() :Patient empty() fill( Patient)

12 HospitalBed ward : String bedNumber : integer occupied : boolean patient : Patient getWard():String getBedNumber():integer isOccupied():boolean getPatient():Patient empty() fill( Patient) fred CurrentBed:HospitalBed ward : "Iris" bedNumber : 14 occupied : TRUE patient : fred «instance of»

13 Exercise 1 Patient Write down attributes for a patient attributes patientID name address bedNumber ward dateOfAdmission DoB consultant notes types String integer String Date Doctor Notes...and their types bed Bed

14 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: )

15 Extension

16 Exercise 2 Draw a class diagram for a Bank account BankAccount accountNumber: String accountName : String balance : double deposit( amount : double) withdraw(amount : double) getAccountNumber():String getBalance():double getAccountName():String

17 BankAccount accountNumber: String accountName : String balance : double deposit( amount: double) withdraw( amount: double) getAccountNumber():String getAccountName():String getBalance():double first : BankAccount accountNumber: "123212" accountName : "Fred" balance : second : BankAccount accountNumber: "786348" accountName : "Harry" balance : 1.77 third : BankAccount accountNumber: "498101" accountName : "Asif" balance : fourth : BankAccount accountNumber: "858838" accountName : "Hans" balance : fifth : BankAccount accountNumber: "573562" accountName : "Nadine" balance : Instances of the class BankAccount

18 Exercise 3 Draw a class diagram for a Rectangle. The methods include finding the area and perimeter of the rectangle Rectangle height : double width : double area(): double perimeter(): double getHeight(): double getWidth(): double setHeight( aHeight: double) setWidth( aWidth: double)

19 Exercise 4 Write a class diagram for an item stored in a warehouse ( ignore methods) Item itemNo : String description : String itemCost : double numberInStock : integer reorderLevel : integer row : integer bay : integer level : integer Problem: If no item in a location in the warehouse, there is nothing recording the state of that location.

20 Exercise 4 ItemLocation itemNo : String description : String itemCost : double numberInStock : integer reorderLevel : integer row : integer bay : integer level : 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...

21 CatalogueItem itemNo : String description : String itemCost : double Item numberInStock : integer reorderLevel : integer isOrdered : boolean Box numberPerBox: integer boxIdNo : String Location row : integer bay : integer level : integer WareHouse Catalogue 1 * * 1 * * 1

22 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 FromLocation Destination FlightNumber more?

23 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 from to number hours minutes seconds year month day

24 Exercise 5 Flight number time : Time date : Date Departure to: String Arrival from: String

25 ...


Download ppt "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."

Similar presentations


Ads by Google