Скачать презентацию Vending Machine Modeling 2003 Fall Software Design CSED Скачать презентацию Vending Machine Modeling 2003 Fall Software Design CSED

7a929d7bf008ab32a9360f14446d16f9.ppt

  • Количество слайдов: 19

Vending Machine Modeling 2003 Fall Software Design (CSED 332) Oct. 30 th, 2003 Pohang Vending Machine Modeling 2003 Fall Software Design (CSED 332) Oct. 30 th, 2003 Pohang University of Science and Technology (POSTECH) Copyright © 2003 SE Lab. Dept. of CSE POSTECH, R. O. Korea

Agenda Domain Model Use Case Collaboration Diagram Design Class Diagram Message Sequence Diagram POSTECH Agenda Domain Model Use Case Collaboration Diagram Design Class Diagram Message Sequence Diagram POSTECH Copyright © 2003 SE Lab. Dept. of CSE POSTECH, R. O. Korea

Domain Model Vending Machine Domain Model modify Owner 1 1. . * Item. Spec Domain Model Vending Machine Domain Model modify Owner 1 1. . * Item. Spec price add or remove item push 1. . * Selection. Button 1. . * 1 add or remove money notifyselection 1 1 * notifychangerequest 1 * 1 Insert coin 1 Insert bill 1 POSTECH Copyright © 2003 SE Lab. Dept. of CSE POSTECH, R. O. Korea Coin. Receiver Bill. Receiver deposit-money-to 1 1 requestdispense turn-on or -off Item. Dispenser 1 Item. Light 1 1. . * Inform-total Transaction. Management total requestchangedispense 1 1 quantity 1 Customer * 1 Item. Management Inform-deduction push Return. Button 1 describes-item display-total-of 1 1 Money. Display 1 add-money query-if-changeable 1 Money. Counter c 50_Count c 100_Count c 500_Count bill_Count 1 Requestdispense Money. Dispenser 1

Use Case Vending Machine Use Cases (1) Actors and their goal Owner - to Use Case Vending Machine Use Cases (1) Actors and their goal Owner - to fill items - to fill money - to change item (info. ) Customer - to buy one or more drinks POSTECH Copyright © 2003 SE Lab. Dept. of CSE POSTECH, R. O. Korea Corresponding Use Cases - Fill Items - Fill Money - Change Items Customer - Buy Items

Vending Machine Use Cases (2) Use Case: Buy Items Use Case Primary Actor: Customer Vending Machine Use Cases (2) Use Case: Buy Items Use Case Primary Actor: Customer Stakeholders: Tax Collector - interested in collecting correct sales tax Precondition: Vending Machine (VM) turned on, not in manager mode, and the numbers of each item contained in VM greater than zero. Post-condition: Customer gets one or more items and exact change. Main Success Scenario *1. Customer deposits money. *2. Customer selects an item. *3. Customer gets change. At any time, 1~3 can be repeated in arbitrary order. Term Definition and Information manager mode The mode that the vending machine turns into when the owner changes item information, fills money or items. selectable item If the following three conditions are met, the item is selectable. - The total amount of money is greater than or equal to the price of the item. - The difference between the total amount of money and the price of the item is changeable. - The quantity of the item contained in the VM is greater than zero. POSTECH Copyright © 2003 SE Lab. Dept. of CSE POSTECH, R. O. Korea Aliases

Vending Machine Use Cases (3) Use Case: Deposit Money Use Case Primary Actor: Customer Vending Machine Use Cases (3) Use Case: Deposit Money Use Case Primary Actor: Customer Precondition: Vending machine turned on, not in manager mode Post-condition: Total amount of money updated and item lights for selectable items are turned on. Main Success Scenario 1. Customer inserts a coin or bill. 2. Vending Machine (VM) updates display with the total amount deposited. 3. VM turns on item lights for selectable items. Extensions 1 a. If an irregular coin or bill is inserted, the VM rejects it. POSTECH Copyright © 2003 SE Lab. Dept. of CSE POSTECH, R. O. Korea

Vending Machine Use Cases (4) Use Case: Select an Item Primary Actor: Customer Precondition: Vending Machine Use Cases (4) Use Case: Select an Item Primary Actor: Customer Precondition: Vending machine turned on, not in manager mode, and selectable items lighted Post-condition: Customer gets a selected item if s/he choose selectable one and the total amount of money is deducted by the price of the dispensed item. Main Success Scenario 1. Customer pushes a selection button. 2. If the item corresponds to the pushed button is selectable, VM dispenses the item and deduct total amount of money by the price of the item. 3. VM turns on item lights for selectable items and turns off item lights for not selectable items. POSTECH Copyright © 2003 SE Lab. Dept. of CSE POSTECH, R. O. Korea

Vending Machine Use Cases (5) Use Case: Get Change Primary Actor: Customer Precondition: Vending Vending Machine Use Cases (5) Use Case: Get Change Primary Actor: Customer Precondition: Vending machine turned on, not in manager mode Post-condition: User gets exact change. Total amount of money is updated to zero. Main Success Scenario 1. Customer push the button to get the change. 2. VM updates money display to zero. 3. VM turns off all item lights. 4. VM returns change. POSTECH Copyright © 2003 SE Lab. Dept. of CSE POSTECH, R. O. Korea

Vending Machine Use Cases (6) Use Case: Fill Items Primary Actor: Owner Precondition: Vending Vending Machine Use Cases (6) Use Case: Fill Items Primary Actor: Owner Precondition: Vending machine turned on, not in use by the user Post-condition: Item refilled and item number updated Main Success Scenario 1. Owner opens the cover. 2. Owner fills items. 3. VM counts and updates item numbers. 4. Owner closes the cover. POSTECH Copyright © 2003 SE Lab. Dept. of CSE POSTECH, R. O. Korea

Vending Machine Use Cases (7) Use Case: Fill Money Primary Actor: Owner Precondition: Vending Vending Machine Use Cases (7) Use Case: Fill Money Primary Actor: Owner Precondition: Vending machine turned on and not in use by the user Post-condition: Money refilled and the amount is updated Main Success Scenario 1. Owner opens the cover. 2. Owner fills coins and bills into money holders. 3. VM counts and updates money amount. 4. Owner closes the cover. POSTECH Copyright © 2003 SE Lab. Dept. of CSE POSTECH, R. O. Korea

Vending Machine Use Cases (8) Use Case: Change Items Primary Actor: Owner Precondition: Vending Vending Machine Use Cases (8) Use Case: Change Items Primary Actor: Owner Precondition: Vending machine turned on, not in use by the user Post-condition: Item price information changed Main Success Scenario 1. Owner opens the cover. 2. Owner sets new price for items. 3. Owner closes the cover. POSTECH Copyright © 2003 SE Lab. Dept. of CSE POSTECH, R. O. Korea

Vending Machine SSD (1) : Customer System Sequence Diagram : System SSD 1 – Vending Machine SSD (1) : Customer System Sequence Diagram : System SSD 1 – deposit money : System SSD 2 – select an item : System SSD 3 – get change inserts money( coin or bill ) Money display is updated. Item lights for selectable items are turned on. : Customer selects an item selected item dispensed Money display is updated. Item lights for selectable items are turned on. : Customer request change Money display is reset to zero. All item lights are turned off. change returned POSTECH Copyright © 2003 SE Lab. Dept. of CSE POSTECH, R. O. Korea

System Sequence Diagram Vending Machine SSD (2) : Owner : System SSD 4 – System Sequence Diagram Vending Machine SSD (2) : Owner : System SSD 4 – fill items : System SSD 5 – fill money : System SSD 6 – change items open cover fill items close cover : Owner open cover fill money close cover : Owner open cover modify item price close cover POSTECH Copyright © 2003 SE Lab. Dept. of CSE POSTECH, R. O. Korea

Design Class Diagram of VM Item. Spec price: Integer Price. Input. Device Selection. Button Design Class Diagram of VM Item. Spec price: Integer Price. Input. Device Selection. Button 1 Item. Refill. Sensor set. Price 1 process. Selection 1 set. Quantity 1. . * get. Price() set. Price( price ) 1 get. Price 1 Item. Management 1 quantity: Integer 1 Item. Dispenser dispense() 1 dispense 1 turn-on turn-off 1. . * total. Changed 1 Transaction. Management Coin. Receiver Bill. Receiver 1 Copyright © 2003 SE Lab. Dept. of CSE POSTECH, R. O. Korea 1 1 deposit 1 total: Integer add. Money( amount ) deduct( amount ) get. Total() return. Change() 1 return. Change add. Money 1 deposit 1 Money. Refill. Sensor 1. . * POSTECH return. Change Item. Light total. Changed( total ) set. Quantity( num ) process. Selection() deduct, get. Total Return. Button 1 1 set. Money 1 1 turn. On() turn. Off() is. Changeable display 1 Money. Display 1 display(num) Money. Counter c 50_Count: Integer c 100_Count: Integer c 500_Count: Integer bill_Count: Integer is. Changeable( amount ): Boolean deposit( amount ) set. Money( type, count ) return. Change( amount ) 1 dispense Money. Dispenser 1. . * dispense( count )

Deposit Money POSTECH Copyright © 2003 SE Lab. Dept. of CSE POSTECH, R. O. Deposit Money POSTECH Copyright © 2003 SE Lab. Dept. of CSE POSTECH, R. O. Korea Message Sequence Diagram

Select an Item POSTECH Copyright © 2003 SE Lab. Dept. of CSE POSTECH, R. Select an Item POSTECH Copyright © 2003 SE Lab. Dept. of CSE POSTECH, R. O. Korea Message Sequence Diagram

Get Change POSTECH Copyright © 2003 SE Lab. Dept. of CSE POSTECH, R. O. Get Change POSTECH Copyright © 2003 SE Lab. Dept. of CSE POSTECH, R. O. Korea Message Sequence Diagram

Others Message Sequence Diagram MSD for Fill Items MSD for Fill Money MSD for Others Message Sequence Diagram MSD for Fill Items MSD for Fill Money MSD for Change Items POSTECH Copyright © 2003 SE Lab. Dept. of CSE POSTECH, R. O. Korea

References • Craig Larman, Applying UML and Patterns 2 nd Ed. , 2001, PHPTR References • Craig Larman, Applying UML and Patterns 2 nd Ed. , 2001, PHPTR POSTECH Copyright © 2003 SE Lab. Dept. of CSE POSTECH, R. O. Korea