Presentation is loading. Please wait.

Presentation is loading. Please wait.

Executable UML The Models are the Code - Executable UML Lecture 2 - Using Executable UML Paul Krause.

Similar presentations


Presentation on theme: "Executable UML The Models are the Code - Executable UML Lecture 2 - Using Executable UML Paul Krause."— Presentation transcript:

1 Executable UML The Models are the Code - Executable UML Lecture 2 - Using Executable UML Paul Krause

2 Executable UML Lecture 2 - Using Executable UML v Domain Charts and Use Cases v Class Diagrams v State models

3 Executable UML What is a Domain? Pet name weight Cat standoffIndex Dog slobberFactor Owner Human Van Vehicle Veterinary Medicine

4 Executable UML Example Domain Chart Fuel SalesShopping Forecourt Hardware Interfacing Checkout User InterfaceLogging Telecommunications Interface

5 Executable UML Use Case Description Use Case Name Purpose Preconditions Invariants Primary Scenario Postconditions Make Fuel Delivery To allow a paying customer to deliver fuel of a selected grade The desired fuel grade is available Tank level >4% tank capacity while pump is on 1.Customer removes nozzle from holster; 2.Attendant enables pump; 3.Customer selects one fuel grade; 4.Pump motor is started; 5.Customer uses trigger to control fuel delivery; 6.Customer replaces nozzle in holster; 7.Pump motor is stopped. At least 2 litres of fuel have been delivered

6 Executable UML Domain Level Sequence Diagram Forecourt Hardware InterfacingUser InterfaceFuel Sales Checkout 1: binaryInputChanges 2: nozzleRemoved 3:requestPumpEnable 4:alertAttendantToRequestForPumpEnable 5:pumpEnableButtonPressed 6:pumpEnabled 7:GO creation 8:enablePump 9:setBinaryOutput 10:binaryInputChanges 11:triggerDepressed 12:startPumping 13:impellorPulse 14:fuelUnitDelivered 1: Customer removes nozzle 2: 3:Request pump enable 4: Alert attendant of Customer 5: Attendant enables pump 6: 7: Create Transaction Item 8: 9: Pump motor enabled 10: Customer presses trigger 11: 12: Start pumping fuel 13: loop until trigger released 14: Unit of fuel is delivered 15: …

7 Executable UML Domain Class Diagram - Fuel Sales PumpPumpSpecificationFillingStation Nozzle TankFuelGrade

8 Executable UML Domain Class Diagram - Fuel Sales PumpPumpSpecificationFillingStationNozzleTankFuelGrade 1 isDispensingFuelFor 1..* dispensesFuelAt isSpecifiedBy 1 specifies 0..* isInUseAt 0..1 hasInUse 0..1 1 isLocatedAt 1..* isLocationFor suppliesFuelTo 0..* 1 acquiresFuelFrom 1 currentlyStores 0..* isCurrentlyStoredIn R4R10 R6R5 R1 R2

9 Executable UML Domain Class Diagram - Fuel Sales PumpPumpSpecificationFillingStationNozzleTankFuelGrade 1 isDispensingFuelFor 1..* dispensesFuelAt isSpecifiedBy 1 specifies 0..* isInUseAt 0..1 hasInUse 0..1 1 isLocatedAt 1..* isLocationFor suppliesFuelTo 0..* 1 acquiresFuelFrom 1 currentlyStores 0..* isCurrentlyStoredIn R4R10 R6R5 R1 R2 Delivery 1 wasMadeFrom 0..* wasUsedToMake

10 Executable UML Active vs Passive Classes v Active Classes  The behaviour of instances of active classes (“active objects”) varies over time  e.g. Instances of a Thread class can be started, paused, continued, stopped  This behaviour can be captured in a Statechart v Passive Classes  Passive objects have the same behaviour at all times  Operations on a class are sufficient to define its behaviour  Information classes, e.g. Address, are typically of this kind

11 Executable UML UML Statecharts Closed Down Idle Entry / display Welcome startup closedown Processing Customer Input card inserted / get pin validation received [invalid card] / confiscate Terminating Transaction Processing Transaction withdrawal selected [valid card] / display wait

12 Executable UML Good Practice for Statecharts v Express the behaviour of Active Classes using a Statechart for each active class v Restrict usage to a subset of the full Statechart notation for clarity:  Actions are specified on entry into a state (not on exit, or on the transition itself)  An individual event can only cause a single transition out of a given state v This usage corresponds to expressing behaviour as a “Moore” machine

13 Executable UML Statechart for Delivery Class

14 Executable UML Statechart for Delivery Class

15 Executable UML Statechart for Delivery Class Action Language specifies the detailed action that is performed here in terms of the concepts in the associated domain model

16 Executable UML Next Actions v You should:  Read Chapter 2 of Mellor and Balcer  Preferably also Chapter 2 of Raistrick et al v In future lectures we will need to:  Discuss more on how to build good class models  Introduce Action Languages  Cover more of the basics of Statecharts  Cover ways of building communicating Statecharts  Show how to verify models  Finally, show how to put all the models together and generate an executable


Download ppt "Executable UML The Models are the Code - Executable UML Lecture 2 - Using Executable UML Paul Krause."

Similar presentations


Ads by Google