I guess there are two parts to the solution of this problem.
The first part is designing the system in a way that supports "pluggable" algorithms. This sounds like the Strategy pattern to me.
The second part is deciding how to update the system as new strategies become available. Possibilities for this include:
change the source code and recompile/redeploy each timechange a configuration file and restart the application each timeuse some sort of dynamic class reloading to update a running system You have already ruled out the first option, but it's not easy to tell if the second option would be acceptable, or if you need the third.
My applications typically make a lot of use of option 2. Essentially this approach can be as simple as creating a properties file which contains something like:
(along with any other parameters needed by the application)
Your code should read the properties file when it starts, create an object of the specified class (using Class.forName(
String) and Class.newInstance(), for example), and pass that object as the aggregation strategy into your application.
Option 2 is usually much simpler and more reliable than option 3, which typically requires the creation of a custom classloader (or perhaps the use of a third-party classloader approach such as OSGI or Impala).