DDD toy problem: The Zoo

Foter / Creative Commons Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)

The other day I thought about inventing a “toy DDD problem” to try and practice DDD a little.

So I came up with this contrived/silly idea of a Zoo in need of a system to plan annual maintenance. Please read it with a big grain of salt on business value and realistics/scope of the rules 🙂

The idea is to try and come up with a domain model based on the following problem. If you make a design of it, please share in the comments!

DDD toy problem: The Zoo

We are developing a system to help a Zoo plan annual maintenance. E.g. doing annual cleaning of a fenced garden is something you want to do without having a rhino chasing you, or changing the broken light bulb is a job done best without a monkey picking your tools from you.

In the first iteration of the software, we agree with the zoo owners that just being able to decide whether or not a specific animal can be safely moved from one enclosement to another is the most important task the system has to help out with. Later on we might extend the system to include automatic computation of the “best” plan possible based on some idea of what is best – e.g. minimizing number of movements, or similar criteria. But that is later on.

We need to understand how to move animals around safely, so that we can setup a schedule of movements to clear out one enclosement at a time. Here are the rules governing movement of animals.

Rule 1. Carnivors and herbivors cannot live together.

For example, moving a lion to an enclosement with a zebra is not good, since the zebra will be eaten.

Rule 2: Herbivors can live side-by-side.

Moving a giraffe to the enclosement of an elephant is OK, since both species are herbivors and wont kill each other.

Rule 3: Carnivors of differing species cannot live together.

Moving a tiger to the enclosement of a lion is not good. Only predators of the same species can safely reside in the same enclosement.

Rule 4: Multiple carnivors of same species can live together.

Moving a lion to another lions enclosement is OK.

Rule 5: Flying animals needs to be in cages.

Moving a bird from a cage to a fenced enclosement is not OK, since the bird will simply fly away.

Rule 6: Strong animals needs to be in walled enclosements.

Moving a rhino from a walled enclosement to a fenced enclosement is not OK, since it will just run through the fences.

Rule 7: Midsize animals can live in both walled and fenced enclosements.

Moving a zebra from a walled enclosement to a fenced enclosement is OK, since it won’t run down the fences.

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s