-
-
Save ericnormand/e2a506c9f5cc168ed818791498804167 to your computer and use it in GitHub Desktop.
| # Coffee shop scenario | |
| Background: *This scenario is from a self-service ordering touchscreen at a coffee shop that you are assigned to develop. Jill is a customer who wants some coffee.* | |
| Operation set: | |
| (defn create-order []) ;;=> Order | |
| (defn add-coffee [order coffee]) ;;=> Order | |
| (defn order-price [order]) ;;=> Price | |
| (defn remove-coffee [order coffee-index]) ;;=> Order | |
| (defn update-coffee [order coffee-index f & args]) ;;=> Order | |
| (defn submit-order [order]) ;;=> OrderID | |
| (defn create-coffee []) ;;=> Coffee | |
| (defn set-size [coffee size]) ;;=> Coffee | |
| (defn set-roast [coffee roast]) ;;=> Coffee | |
| (defn add-add-in [coffee add-in]) ;;=> Coffee | |
| (defn remove-add-in [coffee add-in]) ;;=> Coffee | |
| ;; Order | |
| ;; Price - maybe a number of cents? | |
| ;; Coffee-Index - ordinal number | |
| ;; OrderID - UUID?? | |
| ;; Coffee | |
| ;; Size - small | |
| ;; Roast - dark, medium | |
| ;; Add-In - almond-syrup, soy-milk | |
| Jill starts to order some coffee at the touchscreen. | |
| She adds a small, dark roast. | |
| Then she adds a large medium roast with double almond syrup. | |
| She adds a medium medium roast with two soy milk shots (the second one by | |
| accident). | |
| She reads the price and it's too expensive. | |
| So she removes the second coffee (the one with the almond syrup). | |
| Then she realizes the third coffee has two milk soy shots and she removes one. | |
| The price looks good, so she submits the order. |
;;# Coffee shop scenario
;;Background: This scenario is from a self-service ordering touchscreen at a coffee shop that you are assigned to develop. Jill is a customer who wants some coffee.
;; Operation set:
(defn create-order []) ;;=> Order
(defn add-coffee [order coffee]) ;;=> Order
(defn order-price [order]) ;;=> Price
(defn remove-coffee [order coffee-index]) ;;=> Order
(defn update-coffee [order coffee-index f & args]) ;;=> Order
(defn submit-order [order]) ;;=> OrderID
(defn create-coffee []) ;;=> Coffee
(defn set-size [coffee size]) ;;=> Coffee
(defn set-roast [coffee roast]) ;;=> Coffee
(defn add-add-in [coffee add-in]) ;;=> Coffee
(defn remove-add-in [coffee add-in]) ;;=> Coffee
;; Order
;; Price - maybe a number of cents?
;; Coffee-Index - ordinal number
;; OrderID - UUID??
;; Coffee
;; Size - small
;; Roast - dark, medium
;; Add-In - almond-syrup, soy-milk
;;Jill starts to order some coffee at the touchscreen.
(def order (create-order))
;;She adds a small, dark roast.
(def coffee (create-coffee))
(def coffee (set-size coffee :small))
(def coffee (set-roast coffee :dark))
(def order (add-item-to-order coffee)) ;; ;; will give added item an id and will set coffee to base coffee
;;Then she adds a large medium roast with double almond syrup.
(def coffee (set-size coffee :large))
(def coffee (set-roast coffee :medium))
(def coffee (add-add-in coffee :almond-syrup))
(def coffee (add-add-in coffee :almond-syrup))
(def order (add-coffee order coffee))
;;She adds a medium medium roast with two soy milk shots (the second one by
;;accident).
(def coffee (set-size coffee :medium))
(def coffee (set-roast coffee :medium))
(def coffee (add-add-in coffee :soy-milk))
(def coffee (add-add-in coffee :soy-milk))
(def order (add-coffee order coffee))
;;She reads the price and it's too expensive.
;;So she removes the second coffee (the one with the almond syrup).
(def order (remove-coffee order item-id))
;;Then she realizes the third coffee has two milk soy shots and she removes one.
(def order (update-coffee order item-id remove-add-in :soy-milk))
;;The price looks good, so she submits the order.
;;TODO
Uh oh!
There was an error while loading. Please reload this page.