This are my thoughts about the Code Kata’s introduced by Dave Thomas or PragDave. I will work through this Kata’s during the next few days. Ok I will perhaps need rather weeks than days. But essentially I will work on them to get more understanding of some aspects of programming which I wouldn’t touch otherwise.
Most of the idea what a Code Kata is will be covered with the first Kata. Feel free to read it on the website of Dave Thomas. The idea(s) behind Code Kata’s are very impressive and logical for me. So far the hardest point for me is to find the time to do it as expected. Quick, fast, reliable, and produce output which will cover my own expectation of a program.
The second Kata is called ‘Supermarket Pricing’. I believe that all questions asked here can fill a whole book. And even worse some will be different to answer in other countries. For example does rounding exist? For me the answer is sure. But I’m not sure if this will be the fact in Canada. Why I’m sure? I’m grown up in Switzerland and there all prices are calculated to 5 Rappen. If you will compare this value to dollar this will be 5 cent. Everything has to be rounded to an end value of 5 or 0. What will the formula be? It depends on the customer. Will he earn the difference or will he give the difference to his customer? A simple calculation we sell 1’000 eggs with a price of 0.52 sFr. If we sell it 0.50 sFr we will loose 20.00 sFr. If we sell it for 0.55 sFr we will win 30.00 sFr. Now take this game further to every article you will sell … Quiet now Canada is in the process to loose the 1 cent coin. There are several rounding rules on it. The result will almost certain be that more people will use plastic money more. Dear customers what is better use plastic money (and look that the credit card companies earn money with each transaction) or use money and help the shop to spare the transaction to earn more by them self?
This where some thoughts to this theme. For me the answer will be in a pragmatic sense: the customer should be involved in the project team and help the team with the correct decision. I talk out of my experience. I had to re-implement this rounding problem several times in my career.