Pizza Shop Training

THE TRAINING

  • We'll go through a Pizza Shop price calculation tool.
    • Repo Details

      • You'll use this repo {REPO_ADDRESS_GOES HERE}. Development work needs to be done in a branch.
      • The repo is starting out with just the master branch. Please create a dev branch.
      • Create a branch off of dev to do your coding in.
      • I'll provide you a set of requirements.
      • Once the code in your feature branch is where you want it, create a pull request into the dev branch,
      • Initially you’ll work through the requirements as you’d normally do. Still using this pull request process so I can ensure things are on track and know when to provide the next set of requirements.
      • After working through it once, we’ll start over and we’ll use this pull request to have discussions of changes that will make the code more Object Oriented.
      • The goal isn't to do what I say, but to have an understanding of why I say it. Sometimes that might take a couple requirements before it really shows.
      • Once the code is in a state we both like, we'll merge the PR.
      • I'll provide the next set of requirements. You'll create a branch off of dev for the next set of requirements.
      • We'll continue these steps through the set of requirements. Requirements->Code->Refactor
    • Goal

      • This is for you to learn and understand. There's no reward for getting done fast. I'll do my best to guide you to better understanding. If what I ask doesn't make sense, let's continue to discuss it.

The Scenario

  • This is a pricing system for a pizza shop. They're expanding beyond simple Cheese and Pepperoni and decided on a little automation to generate the price and description. Not much, just making life a little easier.
  • This is just the price calculation for pizzas. We can imagine someone else will build the UI on top of your logic. Do whatever you want, they'll have your source code and can make it work.
  • Impl Details

    • CSharp: There should be a Solution with a ClassLibrary project and Unit Test project
    • No UI and No Database
      • The focus on this training is Object Oriented. We'll get to UI and database in latter lessons. The UI/DB interactions need their own exercise focuses.
    • Consider a time-box for getting functionality of the requirements done. I suggest limiting it to 2 hours.
      • The time-box is intended for functionality. Refactoring can extend outside of that time-box.
  • Review Ideas

    • These are notes to the coach, not the developer

    • On Completion of all exercises
      • Look at the completed code; Ask them to identify as many patterns (and a source for that pattern (web, blog, books - doesn't matter))
      • What is the consuming code /forced/ to do? (e.g. Handle Exceptions)

The Requirements

  • Initial

    • The shop has 2 pizza sizes, personal for $9 and family for $18
    • There are two types of toppings; Regular for 10% of the pizza price and Meat for 15% of the pizza price.
      • Regular Toppings: Mozzarella, Mushroom, Olives
      • Meat Toppings: Pepperoni, Bacon, Ham
    • The following functionality is expected
      • Create a pizza
      • Add a topping to the pizza (before and after viewing the price/description of the pizza)
      • Get Price of pizza (as a text type) at any time
      • Get Description of the pizza at any time
  • Mid Range

    • New Pizza Size: Medium for $12
    • Family changed to Large
    • Description format: "{Pizza Size} Pizza with {Toppings}"
    • Toppings need to be removable
    • Usage Tracking System
      • Track the usage of toppings.
        • Personal: 1 unit of each topping
        • Medium: 1.5 units of each topping
        • Large: 2 units of each topping
      • Implementation detail: This is an in-memory tracking.
      • Provide the usage of the system at any time as text.
  • Calzoned

    • New Product of Calzones at Half Size for $9 and Full for $14.
    • Description format: "{Size} {Pizza|Calzone} with {Toppings}
      • Toppings should be comma separated with an 'and' between the last two
    • Ability to resize a pizza or calzone
    • Ability to change a pizza into a calzone and calzone into pizza
    • Usage Tracking System
      • Half: 1 unit of each topping
      • Full: 1.75 units of each topping
  • Premium

    • New Premium Toppings for 32% of the pizza price
      • Premium Toppings: Roasted Garlic, Sundried Tomatoes, Feta Cheese
    • Description format: "{Size} {Pizza|Calzone} with {Regular Toppings}{Meat Toppings}{Premium Toppings}"
      • Toppings should be comma separated with an 'and' between the last two
    • Usage Tracking System
      • Premium toppings are 75% of normal topping usage
        • A Premium topping on a Half Calzone only increases that topping by 0.75 units instead of 1 unit
      • Include units of Dough for each product.
        • Personal: 1 Unit
        • Medium: 1.5 Units
        • Large: 2 Units
        • Half: 1 Unit
        • Full: 1.75 units
  • Expansion

    • New Premium Topping
      • Thyme & Rosemary
    • New Regular Toppings
      • Asiago Cheese, Pineapple
    • New Shop Location!
      • The original location in Springfield has been so successful they've opened one in Branville!
      • Branville location prints different descriptions for the same thing
        • Personal => Mini
        • Bacon => Crispy Ham
      • Branville location doesn't have all the same ingredient
        • Roasted Garlic NOT available in Branville
      • Springfield location doesn't have the follow ingredient
        • Asiago Cheese NOT available in Springfield
    • Provide a text list of all toppings available at the location
    • Provide a text list of all pizzas & calzones at the location
    • Usage Tracking System
      • Track how many of each size of pizza/calzone is sold.
        • include this with the usage provided
    • Implementation Detail
      • The program just needs to know which store it's running for. It will only run for one store at a time. While this would be a "configuration" value; we're not doing files; it can/should be set in the test as a demonstration of how to define which store it is running as.
      • The application does not allow ordering from Springfield and the next order from Branville. If it's running for the Springfield location, ALL orders are for the Springfield location.
  • Specials

    • To simplify some ordering, we need to provide specials as default pizza setups
      • Hawiian => Ham and Pineapple
      • Meat Lovers => Bacon, Pepperoni, Ham
      • Original Veggie => Mushroom, Mozzarella, Olives
    • Pineapple has gone up in cost, it's now the same % as meat
    • A Personal Pizza is now $9.50
    • The price for Asiago Cheese on a personal pizza is 11% of the pizza price
    • The price for Roasted Garlic on a medium pizza is 20% of the pizza price
    • Provide a text list of all specials at a location.
    • Usage Tracking
      • There's been shortages at locations of specific toppings
        • Update the provided topping list to not include toppings that have exceeded their max units
        • Regular toppings have 100 units
        • Meat Toppings have 50 units
        • Special Toppings have 33 units.
  • Calzoned Again

    • Experiments show Calzone's don't need as much Bacon for people to enjoy it
      • Bacon on Calzone is same cost % as regular
      • Usage Tracking for Bacon on Calzone reduced
        • Full is at 1 instead of 1.75
        • Half is at .75 instead of 1
    • New Special
      • Flavorful => Roasted Garlic, Thyme & Rosemary, Feta Cheese
        • Not available in Branville
    • New Product
      • Made identically: "Deep Dish Pie" sized Pizza @ $24 or a "Family" sized Calzone @ $20
        • Description as "Deep Dish Pie" covers the "{Size} {Pizza}" portion of the description.
      • Usage Tracking
        • DeepDish Pie
          • 4 units of dough and 2 units of toppings
          • Except Bacon which is 1.5 units
        • We forgot to include being out of dough - 1000 units
        • Track how much money has been made
    • People at all locations always refer to the Personal Pizza as a "My Pie", the description should reflect this.
  • Currency

    • A third location has opened up - Bricksburg
    • This location uses a different currency
      • Bricksburg uses a different currency; BLK
      • Springfield and Branville use use LZY
      • $1.00 LZY is 1,75& BLK. A $10.00 LZY pizza is 17,50& BLK.
    • Currencies are printed without the currency type "$1.00" and "1,00&"
    • Special Discount
      • Special Pizzas are priced 10% less
        • A Personal Hawiian is now $11.12 where a Personal with Ham and Pineapple would be $12.35.
    • Usage Tracking
      • The report should include how much is left as well as used.
      • The pizzas use "Sauce". That needs to be tracked as well.
        • Pizzas (except Deep Dish Pie) use the same units of sauce as dough
        • Calzones & Deep Dish Pie use 1/2 the units of sauce as dough
    • Description
      • Multiple of the same toppings should be represented as a single item
        • eg: 3x Pepperoni
  • Death and Taxes... Just Taxes

    • We need to include taxes in the price
      • Springfield and Branville have a 9% tax
      • Bricksburg has an 1% tax
    • The Bricksburg location needs the description to be changed
      • {Pizza|Calzone} of {Size} size with {Regular Toppings} regular toppings, {Meat Toppings} meat toppings and {Premium Toppings} premium toppings
  • Costs

    • Springfield got a tax break and is now has an 8.5% tax
    • Meat has gone up a little in price, all meats increase by 3% (of the price of pizza; previously 15% is now 18%)
    • Branville citizens kinda like the Bricksburg Money format, but not currency. Their monetary display should now be "##,##$"
    • If someone calls the wrong location, they should be able to get the price in their desired currency.