Poker review
It took longer than expected, but I finally completed the poker kata. Time for a short little review:
The Good
The crux of the problem is identifying the hand from the seven cards: that is given your two hole cards and the five community cards, do you have a pair, full house, straight-flush, etc. This is then used to compare against all the other players hands to find the winner. I like the implementations of the HandIdentifier interface, and consider this one of the best parts of the kata.
The Bad
This isn't too hard: it has to be the classes within the collections package. It's not that I think the implementation in of itself is bad (it may be, but that's not the point), it's that it's that 'framework-y' or 'infrastructure-y' type work which I spent some time on that isn't directly about solving the problem. And, of course, there's the fact that this type of collections library already exists!
As is often the way, this was actually interesting for me to go into this area a little. It's a very small collections piece which just gives a glimpse about the various decisions, problems, and issues that would arise when thinking about a proper library such as Guava (Google collections).
The Ugly
I've written uglier, but within this project, I think the worst class is PokerRound, in particular the toString method. I haven't checked, but this is probably the longest method in the project, and almost certainly the most complicated to understand. I think the separation between the PokerRound and the RoundWinners class isn't very good which is a part I struggled with a little. It would be worth looking back at this and thinking about the responsibilities of these two classes (SRP).
All in all
Wrapping up, it was quite a bit of fun and somewhat more work than I had imagined when I started. What next? I plan on a short kata break, perhaps a couple of months, but really want to continue learning Scala, so it'll probably be something in that area.
