What is UML UML stands for Unified Modelling Language A way to talk about Object Oriented Design UML is a visual language
firstsecondthird class : attribute : value : instance : Colour hue "blue" name :second
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
shape1shape2shape3 Shape form : String setShape( String) shape1 : Shape form = "triangle" shape2 : Shape form = "rectangle" shape3 : Shape form = "pentagon"
shape1shape2shape3 Shape form : String setShape( String) shape3 : Shape form = "pentagon" shape3.setShape("hexagon") form = "hexagon"
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
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"
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
Exercise 1 Draw a class diagram for a HospitalBed
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
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)
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)
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.
Exercise 4 ItemLocation 0..1 1 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...
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?
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
Exercise 5 Flight number time : Time date : Date Departure to: String Arrival from: String
Your consent to our cookies if you continue to use this website.