From 4024bcf73cb870d3d6b57a6fb975ddc4858bdcf0 Mon Sep 17 00:00:00 2001 From: alinjo Date: Wed, 14 Aug 2024 09:54:52 +0200 Subject: [PATCH] Finished excercise --- Domain-model.md | 29 +++++++++++++++++++++++++++++ EXERCISE1.md | 3 ++- 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 Domain-model.md diff --git a/Domain-model.md b/Domain-model.md new file mode 100644 index 0000000..714574b --- /dev/null +++ b/Domain-model.md @@ -0,0 +1,29 @@ +### Exercise + +Follow the same process as above to translate these two user stories into domain models. + +``` +As a supermarket shopper, +So that I can pay for products at checkout, +I'd like to be able to know the total cost of items in my basket. +``` +| Classes | Methods | Scenario | Outputs | +|-----------|--------------------------------------|-----------------|---------| +| `Product` | `Product(String name, double price)` | Create product | | +| `Basket` | `Add(Product)` | Add to basket | | +| | `GetItems()` | Get items | | +| | `GetTotalPrice()` | Calculate total | Double | + + +``` +As an organised individual, +So that I can evaluate my shopping habits, +I'd like to see an itemised receipt that includes the name and price of the products +I bought as well as the quantity, and a total cost of my basket. +``` +| Classes | Methods | Scenario | Outputs | +|-----------|-------------------------------------|-----------------|---------| +| `Product` | `Product(String name, double price)` | Create product | | +| `Basket` | `Add(Product, int quanity)` | Add to basket | | +| | `GetTotalPrice()` | Calculate total | Double | +| | `ItemizeProduct()` | | | \ No newline at end of file diff --git a/EXERCISE1.md b/EXERCISE1.md index 3af2ea2..ba4af1d 100644 --- a/EXERCISE1.md +++ b/EXERCISE1.md @@ -2,7 +2,8 @@ ### Warm up -A **User Story** describes one thing a program is expected to do, from the perspective of somebody using that program. When planning a program, the client's requirements will be decomposed into many User Stories. Much of a developer's life is spent translating User Stories into a functional system. These systems are made up of different components, and each component is made up of units. We call these systems **Domain Models**. +A **User Story** describes one thing a program is expected to do, from the perspective of somebody using that program. +When planning a program, the client's requirements will be decomposed into many User Stories. Much of a developer's life is spent translating User Stories into a functional system. These systems are made up of different components, and each component is made up of units. We call these systems **Domain Models**. There are various different formats for user stories but they all share a common goal: describe a feature the user wants. Here's one style of user story: