32536: Object Oriented Modelling Vending Machine Terry Corlet, Josip Lozina and Stephan Brumme June 3 rd , 2004 June 3 rd , 2004 Terry Corlet, Josip Lozina and Stephan Brumme - 1 -
Agenda 1. Introduction 2. Process 3. Implementation 4. UML Critique 5. Conclusion June 3 rd , 2004 Terry Corlet, Josip Lozina and Stephan Brumme - 2 -
1 2 3 4 5 Introduction - I • identifying the objective June 3 rd , 2004 Terry Corlet, Josip Lozina and Stephan Brumme - 3 -
1 2 3 4 5 Introduction - II • setting up a plan – who ? – when ? – where ? – what ? • decide on notation – UML • team member roles � certain experiences ? June 3 rd , 2004 Terry Corlet, Josip Lozina and Stephan Brumme - 4 -
1 � 2 3 4 5 Process - I • iterative approach – start with a simple model � refine to build the final model Analysis Design Implementation [Refinement] [Refinement] – we came up with 8 revisions ! June 3 rd , 2004 Terry Corlet, Josip Lozina and Stephan Brumme - 5 -
1 � 2 3 4 5 Process - II • identifying requirements – what is clear ? ! • 80 items available • several buttons • and many more … – what is ambiguous ? • which currency ? – 5 cent rounding – smallest accepted coin ? • items out of stock • tracking sales • and many more … June 3 rd , 2004 Terry Corlet, Josip Lozina and Stephan Brumme - 6 -
1 � 2 3 4 5 Process - III • CRC modelling – class diagram is integral – look for adequate names – semantics • identifying patterns – well-known techniques – often directly mapped to UML structures June 3 rd , 2004 Terry Corlet, Josip Lozina and Stephan Brumme - 7 -
1 � 2 3 4 5 Process - IV • Class diagram 0..1 has a product 1 has a location ProductLocation Product TransactionController has a balance 1 1 1 80 1 1 1 contains coins Balance 0..* 1 «uses» contains products has a transaction controller Coin 1 CoinValidator «uses» creates has a coin validator 1 1 1 1 has a balance has a keypad VendingMachine 1 1 has displays 1 1 has a cancel button 1 1 2 KeyPad Button Display contains numeric buttons 1 1 1 10 NumericButton AlphaButton CancelButton contains alpha buttons 8 June 3 rd , 2004 Terry Corlet, Josip Lozina and Stephan Brumme - 8 -
1 � 2 3 4 5 Process - V • Use case diagram System Select product «extends» Purchase product «extends» Actor1 Pay for product June 3 rd , 2004 Terry Corlet, Josip Lozina and Stephan Brumme - 9 -
1 � 2 3 4 5 Process - VI • State diagram June 3 rd , 2004 Terry Corlet, Josip Lozina and Stephan Brumme - 10 -
1 � 2 3 4 5 Process - VI • Collaboration diagrams – mapping state diagram to OO structure – several diagrams ! 1.0: press() 1.4: productSelected(selection) 1 .6 : s e tM e s s a g e ( n e w M e s s a g e ) June 3 rd , 2004 Terry Corlet, Josip Lozina and Stephan Brumme - 11 -
1 � 2 3 4 5 Process - VI Person Keypad Display Vending machine Transaction Contoller Coin Balance Location Product enter selection • Sequence diagram Main success scenario select product update display insert coin recieve money – emphasize temporal money recieved get product location get product return product relationships dispnese product insert coin add balance 2b Machine cannot accept any more money recieve money money recieved eject money insert coin recieve money 3a Customer presses refund money recieved press eject eject money enter selection select product 3b No items left in that product line update display insert coin recieve money money recieved get product location get product inform customer no stock left select product no stock message 3c Vending machine has no stock enter selection select product 3d Customer inserts excess money update display insert coin recieve money money recieved get product location get product return product dispenses product get balance dispenses change enter selection 3e Can't dispense right change select product update display insert coin recieve money money recieved get balance get product dispenses money June 3 rd , 2004 Terry Corlet, Josip Lozina and Stephan Brumme - 12 -
1 � 2 � 3 4 5 Implementation • done in C# • to test robustness of our design June 3 rd , 2004 Terry Corlet, Josip Lozina and Stephan Brumme - 13 -
1 � 2 � 3 � 4 5 UML Critique - I • UML is not the customer’s language ! – UML is a mix of several notations • too many structural details – and no consistent level of detail (use cases vs. class diagram) • no unique algorithm to design UML diagrams – hundreds of possibilities to model a problem with UML • hard to draw diagrams without software (Visio) June 3 rd , 2004 Terry Corlet, Josip Lozina and Stephan Brumme - 14 -
1 � 2 � 3 � 4 5 UML Critique - II • UML violates basic rules of visualization – human perception – Bertin’s variables • no way to verify and validate requirements � try to take a look at competing modelling languages ! June 3 rd , 2004 Terry Corlet, Josip Lozina and Stephan Brumme - 15 -
1 � 2 � 3 � 4 � 5 Conclusion • all three team members have different background – … but UML helped to speak the same language ! • initial effort to learn UML – but the last meetings were quite efficient and effective � time initially spent paid off • software tools seem to get better and better • developer community accepts UML – now essential skill of advanced developers June 3 rd , 2004 Terry Corlet, Josip Lozina and Stephan Brumme - 16 -
1 � 2 � 3 � 4 � 5 � Questions ? June 3 rd , 2004 Terry Corlet, Josip Lozina and Stephan Brumme - 17 -
Recommend
More recommend