Pattern for Product to Product Variant association
Is there a design pattern to solve the product to product variant association? A product varies from another product by only it's color, size or material only. Every other static properties like name and description are the same.
I looked at the type-object / item-descriptor pattern which does not seem to be a fit. In this case, I'm not creating two types of products but the same type of product but varies in dynamic properties. I don't know these properties (color, size and material) at compile time. I know what they are at run time only.
Varghese Pallathu, Apr 16, 2012
I've a simple pattern I like to use in cases such as these. I call it the comparator pattern. Here's a simple Console app that can be used to describe a possible solution.
I hope this helps
Sameer Lamba, Apr 18, 2012
Thats a good point and one possible answer. I think thats why singleton class can be used for state mangement in stateless scenarios like shopping cart scenario,
Apr 17, 2012