object oriented modelling - stephan oriented modelli… · uml critique - i • uml is not the...

17
Terry Corlet, Josip Lozina and Stephan Brumme June 3 , 2004 32536: Object Oriented Modelling Vending Machine

Upload: others

Post on 24-May-2020

10 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Object Oriented Modelling - Stephan oriented modelli… · UML Critique - I • UML is not the customer ’s language ! – UML is a mix of several notations • too many structural

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

Terry Corlet,Josip Lozina andStephan Brumme

June 3rd, 2004

32536:Object Oriented Modelling

Vending Machine

Page 2: Object Oriented Modelling - Stephan oriented modelli… · UML Critique - I • UML is not the customer ’s language ! – UML is a mix of several notations • too many structural

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

Agenda

1. Introduction

2. Process

3. Implementation

4. UML Critique

5. Conclusion

Page 3: Object Oriented Modelling - Stephan oriented modelli… · UML Critique - I • UML is not the customer ’s language ! – UML is a mix of several notations • too many structural

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

Introduction - I

• identifying the objective

1 2 3 4 5

Page 4: Object Oriented Modelling - Stephan oriented modelli… · UML Critique - I • UML is not the customer ’s language ! – UML is a mix of several notations • too many structural

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

Page 5: Object Oriented Modelling - Stephan oriented modelli… · UML Critique - I • UML is not the customer ’s language ! – UML is a mix of several notations • too many structural

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]

Page 6: Object Oriented Modelling - Stephan oriented modelli… · UML Critique - I • UML is not the customer ’s language ! – UML is a mix of several notations • too many structural

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 …

!?

Page 7: Object Oriented Modelling - Stephan oriented modelli… · UML Critique - I • UML is not the customer ’s language ! – UML is a mix of several notations • too many structural

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�

Page 8: Object Oriented Modelling - Stephan oriented modelli… · UML Critique - I • UML is not the customer ’s language ! – UML is a mix of several notations • too many structural

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

Process - IV

• Class diagram

1 2 3 4 5�

VendingMachineKeyPad

Product BalanceCoin

Display

TransactionController

18contains alpha buttons

1

1creates 11has a keypad

1 1has a balance

11

has a balance11has a transaction controller

1 2has displays10..*contains coins

180contains products

10..1 has a productProductLocation 1 1has a location

11

has a cancel button«uses»«uses»

110contains numeric buttons ButtonCancelButtonNumericButton AlphaButton

CoinValidator1 1has a coin validator

Page 9: Object Oriented Modelling - Stephan oriented modelli… · UML Critique - I • UML is not the customer ’s language ! – UML is a mix of several notations • too many structural

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

Process - V

• Use case diagram

1 2 3 4 5�

Actor1 Purchase productSystem

Select productPay for product

«extends»«extends»

Page 10: Object Oriented Modelling - Stephan oriented modelli… · UML Critique - I • UML is not the customer ’s language ! – UML is a mix of several notations • too many structural

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

Process - VI

• State diagram

1 2 3 4 5�

Page 11: Object Oriented Modelling - Stephan oriented modelli… · UML Critique - I • UML is not the customer ’s language ! – UML is a mix of several notations • too many structural

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: setMessage(newMessage)

Page 12: Object Oriented Modelling - Stephan oriented modelli… · UML Critique - I • UML is not the customer ’s language ! – UML is a mix of several notations • too many structural

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 Contol ler Coin ProductLocationBalanceselect productupdate displayinsert coinenter selectionadd balancerecieve moneymoney recieved get product location get productreturn productdispnese productMain success scenario

insert coin recieve moneymoney recievedeject money2b Machine cannot accept any more money insert coin recieve moneymoney recievedpress ejecteject money3a Customer presses refund3b No items left in that product line3c Vending machine has no stock3d Customer inserts excess money3e Can't dispense right change

select productupdate displayinsert coin recieve moneymoney recieved get product locationenter selection get productinform customer no stock leftselect productno stock message select productupdate displayinsert coinenter selection recieve moneymoney recieved get product location get productreturn productdispenses productdispenses change get balanceselect productupdate displayinsert coinenter selection recieve moneymoney recieved get productdispenses money get balance

Page 13: Object Oriented Modelling - Stephan oriented modelli… · UML Critique - I • UML is not the customer ’s language ! – UML is a mix of several notations • too many structural

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� �

Page 14: Object Oriented Modelling - Stephan oriented modelli… · UML Critique - I • UML is not the customer ’s language ! – UML is a mix of several notations • too many structural

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� � �

Page 15: Object Oriented Modelling - Stephan oriented modelli… · UML Critique - I • UML is not the customer ’s language ! – UML is a mix of several notations • too many structural

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� � �

Page 16: Object Oriented Modelling - Stephan oriented modelli… · UML Critique - I • UML is not the customer ’s language ! – UML is a mix of several notations • too many structural

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

Page 17: Object Oriented Modelling - Stephan oriented modelli… · UML Critique - I • UML is not the customer ’s language ! – UML is a mix of several notations • too many structural

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

Questions

?

1 2 3 4 5� � � � �