Information Technology Reference
In-Depth Information
Now we can put the vending machine subsystem together with the interface part
(the controller and slot) to obtain the required vending machine system, which satis-
fies the design requirements, and the morphims between them are described in the
configuration diagram depicted in Figure 6.
The interface of the vending machine system is shown in the left interface section
of the controller component and the right interface section of the slot component, in
which the controller provides the buttons for the customer to select his favorite item
and confirm or cancel the order, and the slot indicates to the customer to put the coins
in and to get his ordered item and change.
3.3 The Extended Vending Machine System
Now we want to add more behaviors to the vending machine system to improve the
quality of its service. There are two extensions to be made, one for allowing a cus-
tomer to order more than one item in a single transaction and the other to allow more
kinds of coins to be used in payments, and we will show that they can only be
achieved by the usage of extension morphisms.
3.3.1 The Extension Allowing Multiple Items in an Order
One extension we want to make is to allow the customer to select more than one item
in an order, which should be done in the controller component. We must modify the
actions of item buttons to achieve this effect. First, we will extend the controller com-
ponent and show there is an extension morphism from the old controller to this ex-
tended new component. Then a proof is given to justify that it is impossible to regu-
late or refine the controller to obtain the required functionality and the extension mor-
phism is necessary for our purpose.
We introduce a new channel ac: bool (initialized to be true) and weaken the guards
of item buttons actions by taking the disjunction of ac with bt_g. The modified actions
of the controller are as follows:
init ord_g = false o_req = false bt_g = true bt_confirm
= false slot_g = false s_req = false c_item = NULL
ac = true
actions
button_select(id: int) [bt_g,c_item,bt_confirm] :
bt_g ac, false -> bt_g' = false c_item' = c_item *
b_item [id] bt_confirm' = true
[} button_confirm[bt_confirm,slot_g,ac] : bt_confirm, false
-> bt_confirm' = false slot_g' = true ac' = false
[] button_cancel[bt_confirm,ac,bt_g,c_item] : bt_confirm,
false -> bt_g ' = true ac ' = true bt_confirm ' = false
c_item ' = NULL
[] order_ret[o_req,bt_g,c_item,ac]: o_req, false -> o_req ' =
false bt_g ' = true c_item ' = NULL ac ' = true
We call the extended version of the controller component controller'. It is easy to
determine that controller' satisfies the new requirement. After the customer selects an
item button, the enabling guards of button_select actions will remain true because ac
Search WWH ::




Custom Search