I have a business logic like below and I would like to know which design pattern should be used here.
Basically I have an input and number of factories which creates objects which are derived from the same base class.
Input => factory1 => Output1
Input => factory2 => Output2
Input => factoty3 => Output3
……..
……..
The number of factories varies.
This is the kind of logic which will be enclosed in a method which will create a collection of Output1, Output2… and returns it.
Which is the right design pattern in this scenario ?
Another most matching real time example..
I have a filename/pattern and there are different Finders. One for finding the word docs matching the pattern, one for finding the excel docs. one for finding the ppt docs matching the pattern.
At the end all docs(word,xl,ppts) should be returned.
It seems fairly simple as I see it and you may not need a design pattern.
Lets call this object a Processor instead of Factory so as not to confuse with the Factory pattern.
So your code could be simply like this :