Today, I have completed the Coin Change Kata. Below are my notes:
- It took me three and a half hours to complete.
- I realized that using a greedy algorithm was not best, as choosing the largest possible coin denomination would only work for US coin denominations, but not necessarily others.
- It was fun, yet frustrating, to revisit dynamic programming. The last time I wrote a program using dynamic programming was in an algorithms course in my undergraduate university.
- The way I wrote the code was not modular enough to use TDD to solve the problem. Thus, I had to perform a lot of debugging by manually going through the code line by line. The double for loop did not help. Manual testing was very frustrating and took much longer than I expected. If I were to redo the kata, I would perhaps write helper functions that could be tested individually.
P.S. I would have to say that my level of self-awareness of copying code was III during this kata. Please see what the levels mean in my learning plan.
No comments:
Post a Comment