-
-
Save ericnormand/b25712186bb210ab1c52f06655e7dfbd 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.* | |
| 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 soy milk 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.
(Defn create-order []) ;; => Order
Jill starts to order some coffee at the touchscreen.
(Defn add-item [Order Item]) ;; => Order
She adds a small, dark roast.
(Defn create-coffee []) ;; => Coffee
(Defn set-size [coffee size]) ;; => Coffee
(Defn set-roast [coffee roast]) ;; => Coffee
Then she adds a large medium roast with double almond syrup.
(Defn set-flavor [coffee flavor]) ;; => Coffee
(Defn set-flavor [coffee flavor shots]) ;; => Coffee
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.
(Defn get-price [order]) ;; => price
So she removes the second coffee (the one with the almond syrup).
(Defn remove-item [Order item-id]) ;; Order
Then she realizes the third coffee has two soy milk shots and she removes one.
(Defn set-milk-type [coffee milk-type]) ;; Coffee
(Defn set-milk-type [coffee milk-type shots]) ;; Coffee
The price looks good, so she submits the order.
(Defn submit [Order]) ;; => 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.
Jill starts to order some coffee at the touchscreen. (defn order [])
;;=> order
;; Order
She adds a small, dark roast. Then (defn coffee []) ;; coffee (defn
set-size [coffee size]) ;; coffee (defn set-roast [coffe roast]) ;;
coffee
;; Coffee Size small, large, medium Roast dark, medium
(defn add [order coffee] ;; Order she adds a large medium roast with
double almond syrup.
(defn add-syrup [coffee syrup]) ;; coffee
;; Syrup
(defn add-milk [coffee type]) ;; coffe
;; Milk soy
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.
(defn get-price [order]) ;; price
So she removes the second coffee (the one with the almond syrup).
(defn remove [order item]) ;; order
Then she realizes the third coffee has two soy milk shots and she
removes one.
;; implement by remove and add new
The price looks good, so she submits the order.
(defn submit! [order]) ;; => void
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.
;; order: Jill starts to order
;; coffee: some coffee at the touchscreen.
;; roast: She adds a small, dark roast.
;; amend-order: Then she adds a
;; coffee: large medium roast
;; complement syrup: with double almond syrup.
;; amend-order: She adds a medium
;; roast: medium roast
;; complement soy milk: with two soy milk shots
;; complement soy milk - second time: (the second one by accident).
;; She reads the price and it's too expensive.
;; amend-order (by index): So she removes the second coffee (the one with the almond syrup).
;; amend-order (remove complement by index to a coffee): Then she realizes the third coffee has two soy milk shots and she removes one.
;; execute-order: The price looks good, so she submits the order.
;; parts
;; - order - [index of coffees]
;; - coffee - [type, complements]
;; - complement - [type]
;:: # 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.*
;:: Jill starts to order
(defn start-order []) ; => Order
;:: some coffee at the touchscreen.
(defn add-item [order]) ; => Order with a Coffee Item
;:: She adds a small, dark roast.
(defn add-item [order]) ; => Order with a Coffee Item with two Details
;:: Then she adds a large medium roast with double almond syrup.
(defn add-item [order]) ; => Order with two specific Coffees,
; the latter of which has three Details, one of which has a quantity of 2
;:: She adds a medium medium roast with two soy milk shots (the second one by accident).
(defn add-item [order]) ; => Order with three specific Coffees,
; the latter of which again has three Details, one with a quantity of 2
;:: She reads the price and it's too expensive.
(defn calculate-price [order]) ; => BigDecimal
;:: So she removes the second coffee (the one with the almond syrup).
(defn remove-item [order item]) ; => nil, and how to identify the item is a consideration
;:: Then she realizes the third coffee has two soy milk shots and she removes one.
(defn display-order [order]) ; => visual; depending on UI, might be how she notices
; Similar use of remove-item as above
;:: The price looks good, so she submits the order.
(defn submit-order [order]) ; => nilCoffee 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.
(ns domain-exercise)
(defn create-order []) ;;=> order
;; Jill starts to order some coffee at the touchscreen.
(defn add-coffee [order & {:keys [size]}]) ;;=> order
;; She adds a small, dark roast.
(defn change-coffee [order coffee-id & {:keys [size addons]}]) ;;=> order
;; Then she adds a large medium roast with double almond syrup.
(defn add-coffee [order & {:keys [size addons]}]) ;;=> order
;; She adds a medium medium roast with two soy milk shots (the second one by accident).
(defn remove-coffee [order coffee-id]) ;;=> order
;; She reads the price and it's too expensive. So she removes the second coffee (the one with the almond syrup).
(defn change-coffee [order coffee-id & {:keys [addons]}]) ;;=> order
;; Then she realizes the third coffee has two soy milk shots and she removes one.
(defn submit-order [order-id]) ;;=> order
;; The price looks good, so she submits the order.Jill starts to order some coffee at the touchscreen.
;; Order
(defn create-order []) ;;=> Order
;; Coffee
(defn create-coffee []) ;;=> Coffee
She adds a small, dark roast.
(defn coffee-size [coffee size]) ;;=> Coffee
(defn coffee-roast [coffee roast]) ;;=> Coffee
(defn add-to-order [coffee] ;=> Order
Then she adds a large medium roast with double almond syrup.
(defn coffee-syrup [coffee syrup] ;=> Coffee
She adds a medium medium roast with two soy milk shots (the second one by accident).
(defn coffee-mix-in [coffee mix]) ;;=> Coffee
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 soy milk 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.
;; order: Jill starts to order
;; coffee: some coffee at the touchscreen.
;; roast: She adds a small, dark roast.
;; amend-order: Then she adds a
;; coffee: large medium roast
;; complement syrup: with double almond syrup.
;; amend-order: She adds a medium
;; roast: medium roast
;; complement soy milk: with two soy milk shots
;; complement soy milk - second time: (the second one by accident).
;; She reads the price and it's too expensive.
;; amend-order (by index): So she removes the second coffee (the one with the almond syrup).
;; amend-order (remove complement by index to a coffee): Then she realizes the third coffee has two soy milk shots and she removes one.
;; execute-order: The price looks good, so she submits the order.
;; parts
;; - order - [index of coffees]
;; - coffee - [type, complements]
;; - complement - [type]
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.
Jill starts to order some coffee at the touchscreen.
(defn create-order []);; => Order
;; Order
She adds a small, dark roast. Then
(defn create-coffee []) ;; => Coffee
(defn add-coffee [order, coffee];; => Order
;; Coffee
(defn set-roast [coffee, roast]) ;; => Coffee
(defn set-size [coffee size]) ;; => Coffee
;; Roast
;; Size
she adds a large medium roast with double almond syrup.
(defn set-syrup [coffee, syrup, count]) ;; = Coffee
;; Syrup - type of syrup
She adds a medium medium roast with two soy milk shots
(defn add-milk [coffee, milk]);; => Coffee
;; Milk -- type of milk
(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).
(defn remove-coffee [order, coffee]) ;; => Order
Then she realizes the third coffee has two soy milk shots and she removes one.
(defn remove-milk [coffee, milk]);; => Coffee
The price looks good, so she submits the order.
(defn submit-order [order]) ;; => True/False