Im writing an application which can be configured with defined confiugrations (baseline) at the moment 5-8. So some functions (for gui, check algorithms) have to do the processing in diffent way depending on the baseline. Not completly different but, slightly other. Now we do this :
This is very hard to maintain... So we want to change this to something more sofisticated.
Additional we sometimes have to handle fields for a baseline that do not exist in an earlier one.
I would appreciate any help with this topic
Thank you in advance Mike
Win the opportunity to make money on the Internet<br /><a href="http://sweeps.sitesell.com/minirich.html" target="_blank" rel="nofollow">http://sweeps.sitesell.com/minirich.html</a>
Or, define an interface that handles all the methods that are different across configs. Instantiate an object for the current baseline that provides the appropriate functionality for that baseline. The mainline code will not need to care which it is dealing with.
Tanks. @Champbell Ritchie This would work fine for one occurence but there are about 100-150 Objects that need different handling for each and every baseline. Different checking algorithms and additional different gui visibility.
@Bear Bibeault Then the if-elseif tree just moved a bit, but still exists. By the way this was how the old application was meant to be. [ June 25, 2008: Message edited by: Mike Nightsky ]
Its a possibility, altho I really dislike tools that require two languages, in this case, Java + XML
Who says that Chain Of Responsibility needs XML?
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Joined: Aug 18, 2001
Thank you all for your thoughts and answers.
Our architects have some thing thought up with the command pattern. We give it a try in a prototype. But a solution with a rules engine (Jess, JBPM) has not died completly.
Thank's for your help and keep up the good work you all do here!