Enter your Email Address:

Delivered by FeedBurner

To get posts delivered to your Email

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.

2 comments:

Suren said...

State pattern ?

Lakshmi Narayanan N said...

@Suren

Walk, Slow Walk, Chasing, Running and Jumping are various walking behaviors. It depends on the mood of the creatures.

also.. we really need to see how state pattern fit in in overall modeling.

[Hint] There are at least two sets - Creatures and its concretes, Walking and its sub-interfaces/implementations.