dragonwell
Programmer
Hello again my friends,
I am building a data-processing engine that basically takes a number, performs calculations, and returns a result. Pretty simple. There are going to be multiple processing methods, though, which can be used together in any possible combination selected by the user. Each processing method has the same interface, just does the calculation differently. Over time, more processing methods will be required and will need to be plugged in to the system with mimimal effort.
So I'm thinking a basic strategy-like pattern, where I have an abstract BaseProcessor class with a single Process() function, and subclass this for each alternate method.
Now for the interesting part - how to combine a group of processors and have them work sequentially to give one end result. Ideally, I need the abaility to run a set of selected processors in one action, and preserve the individual results of each so that the result of each possible combination can be previewed quickly without having to re-run the entire process each time to see a different combination.
Anyone familiar with Photoshop will understand this is similar to the Layer Effects that can be combined and individually turned on or off as desired.
What I need is a simple framework for combining processors, that is clear and easy to extend. Can anyone suggest the basics of such a design? Are there any patterns that address this problem?
I am building a data-processing engine that basically takes a number, performs calculations, and returns a result. Pretty simple. There are going to be multiple processing methods, though, which can be used together in any possible combination selected by the user. Each processing method has the same interface, just does the calculation differently. Over time, more processing methods will be required and will need to be plugged in to the system with mimimal effort.
So I'm thinking a basic strategy-like pattern, where I have an abstract BaseProcessor class with a single Process() function, and subclass this for each alternate method.
Now for the interesting part - how to combine a group of processors and have them work sequentially to give one end result. Ideally, I need the abaility to run a set of selected processors in one action, and preserve the individual results of each so that the result of each possible combination can be previewed quickly without having to re-run the entire process each time to see a different combination.
Anyone familiar with Photoshop will understand this is similar to the Layer Effects that can be combined and individually turned on or off as desired.
What I need is a simple framework for combining processors, that is clear and easy to extend. Can anyone suggest the basics of such a design? Are there any patterns that address this problem?