Vending Machine Terry Corlet, Josip Lozina and Stephan Brumme June - - PowerPoint PPT Presentation

vending machine
SMART_READER_LITE
LIVE PREVIEW

Vending Machine Terry Corlet, Josip Lozina and Stephan Brumme June - - PowerPoint PPT Presentation

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.


slide-1
SLIDE 1

June 3rd, 2004 Terry Corlet, Josip Lozina and Stephan Brumme

  • 1 -

Terry Corlet, Josip Lozina and Stephan Brumme

June 3rd, 2004

32536: Object Oriented Modelling

Vending Machine

slide-2
SLIDE 2

June 3rd, 2004 Terry Corlet, Josip Lozina and Stephan Brumme

  • 2 -

Agenda

  • 1. Introduction
  • 2. Process
  • 3. Implementation
  • 4. UML Critique
  • 5. Conclusion
slide-3
SLIDE 3

June 3rd, 2004 Terry Corlet, Josip Lozina and Stephan Brumme

  • 3 -

Introduction - I

  • identifying the objective

1 2 3 4 5

slide-4
SLIDE 4

June 3rd, 2004 Terry Corlet, Josip Lozina and Stephan Brumme

  • 4 -

Introduction - II

  • setting up a plan

– who ? – when ? – where ? – what ?

  • decide on notation

– UML

  • team member roles

certain experiences ?

1 2 3 4 5

slide-5
SLIDE 5

June 3rd, 2004 Terry Corlet, Josip Lozina and Stephan Brumme

  • 5 -

Process - I

  • iterative approach

– start with a simple model refine to build the final model – we came up with 8 revisions !

1 2 3 4 5

  • Analysis

Design Implementation [Refinement] [Refinement]

slide-6
SLIDE 6

June 3rd, 2004 Terry Corlet, Josip Lozina and Stephan Brumme

  • 6 -

Process - II

1 2 3 4 5

  • 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 …

! ?

slide-7
SLIDE 7

June 3rd, 2004 Terry Corlet, Josip Lozina and Stephan Brumme

  • 7 -

Process - III

  • CRC modelling

– class diagram is integral – look for adequate names – semantics

  • identifying patterns

– well-known techniques – often directly mapped to UML structures

1 2 3 4 5

slide-8
SLIDE 8

June 3rd, 2004 Terry Corlet, Josip Lozina and Stephan Brumme

  • 8 -

Process - IV

  • Class diagram

1 2 3 4 5

  • VendingMachine

KeyPad Product Balance Coin Display TransactionController 1 8 contains alpha buttons 1 1 creates 1 1 has a keypad 1 1 has a balance 1 1 has a balance 1 1 has a transaction controller 1 2 has displays 1 0..* contains coins 1 80 contains products 1 0..1 has a product ProductLocation 1 1 has a location 1 1 has a cancel button «uses» «uses» 1 10 contains numeric buttons Button CancelButton NumericButton AlphaButton CoinValidator 1 1 has a coin validator

slide-9
SLIDE 9

June 3rd, 2004 Terry Corlet, Josip Lozina and Stephan Brumme

  • 9 -

Process - V

  • Use case diagram

1 2 3 4 5

  • Actor1

Purchase product

System

Select product Pay for product «extends» «extends»

slide-10
SLIDE 10

June 3rd, 2004 Terry Corlet, Josip Lozina and Stephan Brumme

  • 10 -

Process - VI

  • State diagram

1 2 3 4 5

slide-11
SLIDE 11

June 3rd, 2004 Terry Corlet, Josip Lozina and Stephan Brumme

  • 11 -

Process - VI

  • Collaboration diagrams

– mapping state diagram to OO structure – several diagrams !

1 2 3 4 5

  • 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 )
slide-12
SLIDE 12

June 3rd, 2004 Terry Corlet, Josip Lozina and Stephan Brumme

  • 12 -

Process - VI

  • Sequence diagram

– emphasize temporal relationships

1 2 3 4 5

  • Person
Keypad Display Vending machine Transaction Contoller Coin Product Location Balance select product update display insert coin enter selection add balance recieve money money recieved get product location get product return product dispnese product Main success scenario insert coin recieve money money recieved eject money 2b Machine cannot accept any more money insert coin recieve money money recieved press eject eject money 3a Customer presses refund 3b No items left in that product line 3c Vending machine has no stock 3d Customer inserts excess money 3e Can't dispense right change select product update display insert coin recieve money money recieved get product location enter selection get product inform customer no stock left select product no stock message select product update display insert coin enter selection recieve money money recieved get product location get product return product dispenses product dispenses change get balance select product update display insert coin enter selection recieve money money recieved get product dispenses money get balance
slide-13
SLIDE 13

June 3rd, 2004 Terry Corlet, Josip Lozina and Stephan Brumme

  • 13 -

Implementation

  • done in C#
  • to test robustness of our design

1 2 3 4 5

slide-14
SLIDE 14

June 3rd, 2004 Terry Corlet, Josip Lozina and Stephan Brumme

  • 14 -

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)

1 2 3 4 5

slide-15
SLIDE 15

June 3rd, 2004 Terry Corlet, Josip Lozina and Stephan Brumme

  • 15 -

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 !

1 2 3 4 5

slide-16
SLIDE 16

June 3rd, 2004 Terry Corlet, Josip Lozina and Stephan Brumme

  • 16 -

Conclusion

1 2 3 4 5

  • 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

slide-17
SLIDE 17

June 3rd, 2004 Terry Corlet, Josip Lozina and Stephan Brumme

  • 17 -

Questions

?

1 2 3 4 5