Code Monkey home page Code Monkey logo

supermarketpricing-kata's Introduction

Source:

http://codekata.com/kata/kata01-supermarket-pricing/

Goal

The goal of this kata is to practice a looser style of experimental modelling.

Look for as many different ways of handling the issues as possible.

Consider the various tradeoffs of each.

What techniques are best for exploring these models?

For recording them?

How can you validate a model is reasonable?

Some Guidelines:

Some things in supermarkets have simple prices: this can of beans costs $0.65. Other things have more complex prices. For example:

three for a dollar (so what's the price if I buy 4, or 5?)

$1.99/pound (so what does 4 ounces cost?)

buy two, get one free (so does the third item have a price?)

This kata involves no coding. The exercise is to experiment with various models for representing money and prices that are flexible enough to deal with these (and other) pricing schemes, and at the same time are generally usable (at the checkout, for stock management, order entry, and so on). Spend time considering issues such as:

does fractional money exist?

when (if ever) does rounding take place?

how do you keep an audit trail of pricing decisions (and do you need to)?

are costs and prices the same class of thing?

if a shelf of 100 cans is priced using 'buy two, get one free', how do you value the stock?

This is an ideal shower-time kata, but be careful. Some of the problems are more subtle than they first appear. I suggest that it might take a couple of weeks worth of showers to exhaust the main alternatives.

Objectives status

  • Have a representation for money and currency
  • Implement mantainable discountable items
  • Implement Stock management
  • Have your groceries calculated by this thing
  • Implement making a purchase at a register
  • Implement List totalling considering -> three for a dollar (so what's the price if I buy 4, or 5?)
  • Implement discounts over a period of time
  • Implement data loading off some external repo

Another guys' solutions:

https://github.com/raddanesh/Kata01 https://github.com/andymeek/kata01-supermarket-pricing

NOTE: Check this repo's branches for more approaches

supermarketpricing-kata's People

Contributors

jptouron avatar

Watchers

James Cloos avatar Marcos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.