Machine gun Kata (OOP)

_config.yml

All the problems posted on code review start to look the same. Here is the original code:

And here is the solution I employed. It basically looks like the 99 bottles problem. All I did was refactor and extract a class where I saw fit, and to then employ a factory method to choose specific instances of that said class. Those instances behave slightly differently from each other.

Here is the code:

Please study the code.

More important is the ability to get there - via refactoring bit by bit. I learned that by reading Sandi Metz’s 99 bottles book. Worth its weight in gold!

Written on April 12, 2017