Conway's Game of Life, the classic problem to tackle in a code retreat, solved without the use of conditionals.
The Four Rules of simple Design almost apply:
- The tests pass (or the test passes to be precise)
- Code is fairly small, the number of classes could be hardly smaller, methods are short and not very numerous
- Few repetitions
- Naming is mostly comprehensible, although arguably that point will almost always lead to controversy
And yet... something seems strange.
A tiny bonus for those who preach that code coverage alone would be a metric for quality. The test has huge coverage - but no benefit at all.
Because after all, it is a fun solution.
Disclaimer: All alliterations are accidental.