1 / 25

Introduction to UML

Introduction to UML. What is UML. UML stands for U nified M odelling L anguage. A way to talk about Object Oriented Design. UML is a visual language. first. second. third. class :. Colour. instance :. attribute :. hue. value :. "blue". name :. second. first.

yaholo
Download Presentation

Introduction to UML

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

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. first second third class : Colour instance : attribute : hue value : "blue" name : second

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

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

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

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

  8. shape1 : ColouredShape shape3 : ColouredShape shape1 : ColouredShape shape3 : ColouredShape hue = "blue" form = "triangle" hue = "green" form = "hexagon" hue = "red" form = "triangle" hue = "green" form = "octagon" shape1 shape2 shape3 shape1.setHue("red") shape3.setShape("octagon")

  9. ward bedNumber occupied patient getWard( ) :String getBedNumber( ) : int isOccupied( ) : boolean getPatient ( ) : Patient empty( ) fill( Patient ) Exercise 1 attributes types String integer boolean Patient A hospital bed methods 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. «instance of» CurrentBed:HospitalBed ward : "Iris" bedNumber : 14 occupied : TRUE patient : fred fred HospitalBed ward : String bedNumber : integer occupied : boolean patient : Patient getWard():String getBedNumber():integer isOccupied():boolean getPatient():Patient empty() fill( Patient)

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

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

  15. Extension

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

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

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

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

  20. Item Location itemNo : String description : String itemCost : double numberInStock : integer reorderLevel : integer row : integer bay : integer level : integer Exercise 4 0..1 Item Location 1 If the system was also used to create a catalogue, an item not held in stock cannot appear in the catalogue! ... much later ...

  21. 1 * 1 0..1 1 * 1 * 1 * CatalogueItem Catalogue 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

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

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

  25. ...

More Related