+ All Categories
Home > Documents > Pohang University of Science and Technology (POSTECH) Copyright © 2003 SE Lab. Dept. of CSE...

Pohang University of Science and Technology (POSTECH) Copyright © 2003 SE Lab. Dept. of CSE...

Date post: 19-Dec-2015
Category:
View: 213 times
Download: 0 times
Share this document with a friend
19
Pohang University of Science and Technology (POSTECH) Copyright © 2003 SE Lab. Dept. of CSE POSTECH, R.O. Korea Vending Machine Modeling Vending Machine Modeling 2003 Fall Software Design (CSED332) Oct. 30 th , 2003
Transcript
Page 1: Pohang University of Science and Technology (POSTECH) Copyright © 2003 SE Lab. Dept. of CSE POSTECH, R.O. Korea Vending Machine Modeling 2003 Fall Software.

Pohang University of Science and Technology (POSTECH)

Copyright © 2003 SE Lab. Dept. of CSEPOSTECH, R.O. Korea

Vending Machine ModelingVending Machine Modeling

2003 Fall Software Design (CSED332)

Oct. 30th, 2003

Page 2: Pohang University of Science and Technology (POSTECH) Copyright © 2003 SE Lab. Dept. of CSE POSTECH, R.O. Korea Vending Machine Modeling 2003 Fall Software.

POSTECHCopyright © 2003

SE Lab. Dept. of CSEPOSTECH, R.O. Korea

AgendaAgenda

Domain Model

Use Case

Collaboration Diagram

Design Class Diagram

Message Sequence Diagram

Page 3: Pohang University of Science and Technology (POSTECH) Copyright © 2003 SE Lab. Dept. of CSE POSTECH, R.O. Korea Vending Machine Modeling 2003 Fall Software.

POSTECHCopyright © 2003

SE Lab. Dept. of CSEPOSTECH, R.O. Korea

Vending Machine Domain Model Domain ModelDomain Model

SelectionButton

ReturnButton

ItemSpec

price

ItemLight

ItemDispenser

MoneyDispenser

MoneyCounter

c50_Countc100_Countc500_Countbill_Count

ItemManagement

quantity

1

1

1

1

1

1

1

11

deposit-money-to

deposit-money-to

add or remove item

MoneyDisplayTransactionManagement

total

Owner

Customer

CoinReceiver

BillReceiver

1

11

1..*

1..*

11

11

1

11

11

1

1..*

1

1

1

**

* *

1 1

1

1..*

modify

add or remove money

push

push

Insert coin

Insert bill

describes-item

Inform-total

add-money

notify-change-request

notify-selection

display-total-of

Request-dispense

turn-on or -off

request-dispense

Inform-deduction

query-if-changeable

request-change-dispense

Page 4: Pohang University of Science and Technology (POSTECH) Copyright © 2003 SE Lab. Dept. of CSE POSTECH, R.O. Korea Vending Machine Modeling 2003 Fall Software.

POSTECHCopyright © 2003

SE Lab. Dept. of CSEPOSTECH, R.O. Korea

Vending Machine Use Cases (1) Use CaseUse Case

Actors and their goal

Owner- to fill items- to fill money- to change item (info.)

Customer- to buy one or more drinks

Corresponding Use Cases

- Fill Items- Fill Money- Change Items

Customer- Buy Items

Page 5: Pohang University of Science and Technology (POSTECH) Copyright © 2003 SE Lab. Dept. of CSE POSTECH, R.O. Korea Vending Machine Modeling 2003 Fall Software.

POSTECHCopyright © 2003

SE Lab. Dept. of CSEPOSTECH, R.O. Korea

Vending Machine Use Cases (2)

Use CaseUse Case Use Case: Buy Items

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 Aliases

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.

Page 6: Pohang University of Science and Technology (POSTECH) Copyright © 2003 SE Lab. Dept. of CSE POSTECH, R.O. Korea Vending Machine Modeling 2003 Fall Software.

POSTECHCopyright © 2003

SE Lab. Dept. of CSEPOSTECH, R.O. Korea

Vending Machine Use Cases (3)

Use CaseUse Case Use Case: Deposit Money

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.

Extensions1a. If an irregular coin or bill is inserted, the VM rejects it.

Page 7: Pohang University of Science and Technology (POSTECH) Copyright © 2003 SE Lab. Dept. of CSE POSTECH, R.O. Korea Vending Machine Modeling 2003 Fall Software.

POSTECHCopyright © 2003

SE Lab. Dept. of CSEPOSTECH, R.O. Korea

Vending Machine Use Cases (4) Use CaseUse Case

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 Scenario1. 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.

Page 8: Pohang University of Science and Technology (POSTECH) Copyright © 2003 SE Lab. Dept. of CSE POSTECH, R.O. Korea Vending Machine Modeling 2003 Fall Software.

POSTECHCopyright © 2003

SE Lab. Dept. of CSEPOSTECH, R.O. Korea

Vending Machine Use Cases (5) Use CaseUse Case

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.

Page 9: Pohang University of Science and Technology (POSTECH) Copyright © 2003 SE Lab. Dept. of CSE POSTECH, R.O. Korea Vending Machine Modeling 2003 Fall Software.

POSTECHCopyright © 2003

SE Lab. Dept. of CSEPOSTECH, R.O. Korea

Vending Machine Use Cases (6) Use CaseUse Case

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.

Page 10: Pohang University of Science and Technology (POSTECH) Copyright © 2003 SE Lab. Dept. of CSE POSTECH, R.O. Korea Vending Machine Modeling 2003 Fall Software.

POSTECHCopyright © 2003

SE Lab. Dept. of CSEPOSTECH, R.O. Korea

Vending Machine Use Cases (7) Use CaseUse Case

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.

Page 11: Pohang University of Science and Technology (POSTECH) Copyright © 2003 SE Lab. Dept. of CSE POSTECH, R.O. Korea Vending Machine Modeling 2003 Fall Software.

POSTECHCopyright © 2003

SE Lab. Dept. of CSEPOSTECH, R.O. Korea

Vending Machine Use Cases (8) Use CaseUse Case

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.

Page 12: Pohang University of Science and Technology (POSTECH) Copyright © 2003 SE Lab. Dept. of CSE POSTECH, R.O. Korea Vending Machine Modeling 2003 Fall Software.

POSTECHCopyright © 2003

SE Lab. Dept. of CSEPOSTECH, R.O. Korea

Vending Machine SSD (1) System Sequence DiagramSystem Sequence Diagram

:Customer :System

inserts money( coin or bill )

Money display is updated.Item lights for selectable items are turned on.

:Customer :System

selects an item

change returned

:Customer :System

request change

Money display is reset to zero.All item lights are turned off.

Money display is updated.Item lights for selectable items are turned on.

selected item dispensed

SSD1 – deposit money

SSD2 – select an item

SSD3 – get change

Page 13: Pohang University of Science and Technology (POSTECH) Copyright © 2003 SE Lab. Dept. of CSE POSTECH, R.O. Korea Vending Machine Modeling 2003 Fall Software.

POSTECHCopyright © 2003

SE Lab. Dept. of CSEPOSTECH, R.O. Korea

Vending Machine SSD (2) System Sequence DiagramSystem Sequence Diagram

:Owner :System

open cover

:Owner :System

:Owner :System

SSD4 – fill items

SSD5 – fill money

SSD6 – change items

modify item price

close cover

open cover

fill items

close cover

open cover

fill money

close cover

Page 14: Pohang University of Science and Technology (POSTECH) Copyright © 2003 SE Lab. Dept. of CSE POSTECH, R.O. Korea Vending Machine Modeling 2003 Fall Software.

POSTECHCopyright © 2003

SE Lab. Dept. of CSEPOSTECH, R.O. Korea

Design Class Diagram of VM Design Class DiagramDesign Class Diagram

1

1

1

1..*

1

1

1

1

deposit

setMoney

1

1

1..*

1

1

11

1..*1

1

1 1

1

1..*

setPrice

getPrice

totalChanged

returnChange

returnChange display

dispense

turn-on turn-off

dispense

deduct, getTotal

SelectionButton

ReturnButton

CoinReceiver

ItemDispenser

dispense()

ItemLight

turnOn()turnOff()

MoneyDisplay

display(num)

MoneyDispenser

dispense( count )

MoneyCounter

c50_Count: Integerc100_Count: Integerc500_Count: Integerbill_Count: Integer

isChangeable( amount ): Booleandeposit( amount )setMoney( type, count )returnChange( amount )

ItemManagement

quantity: Integer

totalChanged( total )setQuantity( num )processSelection()

ItemSpec

price: Integer

getPrice()setPrice( price )

isChangeable

PriceInputDevice

11deposit

BillReceiver

MoneyRefillSensor

1 1processSelection

1 1setQuantityItemRefillSensor

addMoney

addMoney( amount )deduct( amount )getTotal()returnChange()

TransactionManagement

total: Integer

Page 15: Pohang University of Science and Technology (POSTECH) Copyright © 2003 SE Lab. Dept. of CSE POSTECH, R.O. Korea Vending Machine Modeling 2003 Fall Software.

POSTECHCopyright © 2003

SE Lab. Dept. of CSEPOSTECH, R.O. Korea

Deposit Money Message Sequence DiagramMessage Sequence Diagram

Page 16: Pohang University of Science and Technology (POSTECH) Copyright © 2003 SE Lab. Dept. of CSE POSTECH, R.O. Korea Vending Machine Modeling 2003 Fall Software.

POSTECHCopyright © 2003

SE Lab. Dept. of CSEPOSTECH, R.O. Korea

Select an Item Message Sequence DiagramMessage Sequence Diagram

Page 17: Pohang University of Science and Technology (POSTECH) Copyright © 2003 SE Lab. Dept. of CSE POSTECH, R.O. Korea Vending Machine Modeling 2003 Fall Software.

POSTECHCopyright © 2003

SE Lab. Dept. of CSEPOSTECH, R.O. Korea

Get Change Message Sequence DiagramMessage Sequence Diagram

Page 18: Pohang University of Science and Technology (POSTECH) Copyright © 2003 SE Lab. Dept. of CSE POSTECH, R.O. Korea Vending Machine Modeling 2003 Fall Software.

POSTECHCopyright © 2003

SE Lab. Dept. of CSEPOSTECH, R.O. Korea

Others Message Sequence DiagramMessage Sequence Diagram

MSD for Fill Items

MSD for Fill Money

MSD for Change Items

Page 19: Pohang University of Science and Technology (POSTECH) Copyright © 2003 SE Lab. Dept. of CSE POSTECH, R.O. Korea Vending Machine Modeling 2003 Fall Software.

POSTECHCopyright © 2003

SE Lab. Dept. of CSEPOSTECH, R.O. Korea

ReferencesReferences

• Craig Larman, Applying UML and Patterns 2nd Ed., 2001, PHPTR


Recommended