Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

effects processing engine

Status
Not open for further replies.

dragonwell

Programmer
Oct 21, 2002
863
US
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?

 
Layering? How about the Decorator Pattern?

Tim
 
Thanks Tim! I was thinking about the decorator pattern. By Layering do you mean the UI/Appliclation/BLL/Infastructure kind of layering or something else?
 
I was thinking of functionality layering. Each layer provides some processing of the thing passing through the layers, such as transformation or filtering. I wasn't referring to Architecture Layers.

Tim
 
OK - I see. I had not thought about funtionality layering before (and have had my head in architecture so much lately). But I think that is actually how I am going to do it. Keep a sorted list of the processors to use, apply them in sequence to the subject. Am I correct in that whenever a layer is removed or the list is re-sorted, the process must be completely redone, passing the subject through the new list?



[pipe]
Share your knowledge! -
 
Yes. With different orderings / instances of decoration, the output will be different. You'd make the changes and start again.

Tim
 
Goo dluck on this - i worked on a project that had a similar requirement and found it to be the funnest project I ever worked on!
 
Thanks! I've completed the engine and it was a lot of fun... [bigsmile]
 
I ended up having formulas, formulaoutput (The persisted output of the formula) and another object (Forgot the name) that used the decorator to bring the formulas together. FormulaOutput could be rendered to a database, excel spreadsheet etc...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top