To practice I've coded an example of the Double Dispatch implementation pattern I read about first in Rebecca Wirfs-Brock's Object Design: Roles, Responsibilities, and Collaborations and later in Kent Beck's Implementation Patterns.
I used the pattern to implement the rules of the Rock-paper-scissors hand game.
I drove the code using TDD.
Having a "dense day", I painted myself into a corner, but I finally managed to refactor my way to a solution.
I used the Igloo C++ BDD framework, which the more I use, the more I like.
I put the resulting code in this repository. I committed after each new test was made to pass and after each refactoring, so you can follow all the process (including my silly initial mistakes).
No comments:
Post a Comment