Reputation: 67233
I have to create a lot of objects which relate to each (i.e. one is passed in as a parameter of the constructor to the other) to do some work.
Usually factory type patterns seem suitable for making only one object. This is several. I was thinking of doing something like a fluent interface and then the properties on the class are the final objects, or use the specification design pattern. Is there any other better way?
Thanks
Upvotes: 1
Views: 99
Reputation: 36035
Consider using dependency injection.
You did not mention the platform, but if its dot net (as hinted by your username) then I suggest StructureMap.
Upvotes: 1
Reputation: 8926
It sounds like you want the builder pattern
sorry, that link had a dead image, this one may help also
Upvotes: 1