Sing a Song Kata


Inspired by London Code Dojo

The “Situation”

Code to produce a popular children’s nursery rhyme was produced by a web agency for the customer last year. The customer now desires to produce multiple different versions of the song using the same structure but based on different themes, for example a current popular children’s movie featuring a cast of animals. The customer asks that you make the song configurable for different lists of animals. The customer cannot guarantee that there will be the same number of animals in each different version.

No documentation or tests were provided by the previous developer.

Your Task

Refactor the code to allow for the customer’s needs. Remember: refactoring can only be done in the presence of tests that are passing, and after refactoring the tests still pass!

Get the Code

On GitHub (This kata can be done using C++, C#, Elixir, Go, Java, JavaScript, PHP, Python, Ruby) If your favorite language is missing, feel free to create a pull request. Be sure the maintainer will be happy ;-)

Image credits

Image by Egga. It shows an exemplary flip chart to facilitate the kata.