[Tutor] Mapping to an equivalent / similar object?

Allen Fowler allen.fowler at yahoo.com
Fri May 29 00:41:04 CEST 2009


Imagine the relationship between an Ice Cream retail store and the several manufactures that supply it's flavors.

The retail store has a single list of flavors and any given flavor can be made by one or more manufactures.  (Most are made by several.)

The store's stock monitoring system will generate a list of Flavor() objects that need to be ordered.  Say: Flavor('Vanilla'), or better yet, CanonicalFlavor('Vanilla')

The store's ordering system takes as input a CanonicalFlavor('Vanilla') object that needs to be purchased, and must route this to a manufacturer's ordering system.  The choice of which manufacture to use is based on external factors.

However, each manufacturer's ordering system is different, and each expects a radically different variation of a Flavor object.  (Different ingredients, parameters, etc. )

How should the mapping between the CanonicalFlavor('Vanilla') object and ManufAFlavor('Vanilla') / ManufBFlavor('Vanilla') objects be handled.

(Or is this the wrong way to do this?)

Thank you,


More information about the Tutor mailing list