views:

97

answers:

1

We are building a "configurator" application for conveyors. Basically user comes in and picks a model, then start picking the parts they want. Some components have dependencies on other components. E.g. if I pick Part A, then I am required to select 1 or more Part B's. It is somewhat similar to configuring a PC at Dell.com. The app will also provide suggestions on parts/components.

Based on this info, I am researching if there is an existing pattern(s) that would allow us to make this easy to maintain and design. Any thoughts, ideas? Are there any open source projects that have similar functionality I can borrow ideas/patterns?

I am mostly interested in how to define "rules" between components without hardcoding the rules/dependencies.

Thanks for any help.

Not that it should matter, but we are building this in .NetFramework 3.5/Asp.Net

+1  A: 

Without a good reason to do otherwise, I'd keep it simple and each part would have a list of dependent parts.

Draemon
So, you are saying create a class per product/component that knows its own rules?
B Z
That would be the simplest way. I guess it depends what sort of dependency we're talking about. If it's a fundamental property of the part - say they are mating parts - then it makes sense for the dependency to belong to the part...
Draemon
...If it's (say) a policy thing (ie "We only let you buy A and B together") then the dependency doesn't really belong to the parts and you may want to maintain an external dependency map.Either way is pretty easy to implement.
Draemon