CHOW #167 – The coin tender kata

The challenge of this week is a very famous Code Kata called as Coin Tender. This kata assumes very important and have subtle association with the Post

Hence I suggest you to first attempt to practice this Code Kata before reading the post. Then again return to this Code Kata. 

Specification

Well, the requirement is, creating a virtual coin-tender, to dispense Penny, Nickel, Dime and Quarter in exchange of the given input.

Where :

P -> Penny; 
N -> Nickel (5 Penny);
D -> Dime (5 Nickel or 10 Penny);
Q -> Quarter (25 Penny);

So, 

if you input 7 to the coin tender it should respond with NPP. 

If you input 42 the response should be QDNPP.

Expectation

The code satisfies the first two test cases. The given code is deliberately un-refactored. 

The challenge is; refactor the code and extend the code to dispense Dime and Quarter.

Enjoy observing how your code is transformed each time you introduce a test.

https://gist.github.com/krsmanian1972/64699016325e6e6cd64e3e3f32cebf4b

https://gist.github.com/krsmanian1972/0ed4713a2ffc20875e6bdfb27b8a59f1

Looking forward to your clean code and observations.

Thanks.

Raja Subramanian

Leadership, Communication; Culture
What do you think?

2 Responses

  1. Velocity of each individual iteration will be a different figure. There are many ways velocity gets impacted. Apart from planned absence (planned leave, training etc.) and holidays, there could be unplanned absences caused by illness, personal emergency etc. which impact velocity. User stories that do not get completed in an iteration get moved to next iteration. This brings down the velocity of the iteration where the story was started and bumps up the velocity of the iteration where it got completed. This being the situation, good practice is to take an average of last five or six iterations as the velocity of the team. Team stability is another factor that impacts velocity. Teams that have higher churn will see higher volatility in velocity. Other factors such as change in technology, adoption of new tools, increase in automation, will also impact velocity either positively or negatively! However, if team is stable and has reached “performing stage” steady rise in average velocity will be seen over a period of time till any of the factors mentioned above comes into play and impacts it.

    1. Thanks Milind, fully agree with your comment.
      Finally, irrespective of the increasing trend in velocity, there is improvement for sure. This cannot be missed, if observed. One of the intent of my blog is to encourage this observation, by taking a mildly provocative stand.

Leave a Reply

What to read next