11 April 2010

Software Design - Puzzle #2

Here goes another design puzzle.

There are varieties of creatures (example Man, Lion, Tiger, Monkey) each exhibiting varieties of walking behaviors (Walk, Slow Walk, Chasing, Running, Jumping). The walking behavior changes based on the mood of the creatures. (Hint: This forces us to bring in different walking behaviors to our objects dynamically).

Can you analyze this requirement and come up with design pattern(s) that could solve this problem and set of classes to model this requirement.