We have a product with standard functionality and our clients also customize the product to their requirements. But currently they make changes in the core product code. I want to know the approaches that can be used to make a j2EE application extensible or customizable. To elaborate this, read below: for example: consider below class:
Class A{
public void doSomething(Object o){
// standard product functionality goes here.
// due to client customizations. client code also goes here.
}
}
In above class, client has added the code to the core product code. Ideally the product code should not be modified based on open-closed principle.
Currently we dont directly allow client to add code in the method but provide customization points as below.
Class A{
public ClassAExtension ext;
public void doSomething(Object o){
// standard product functionality goes here.
// client code goes in doClientCustomizations();
ext.doClientCustomizations(Object o);
}
}
So now client uses "ClassAExtension" class to override the behaviour. However, this approach is still not that elegant and makes the product code more cluttered with such customization points.
What different approaches or frameworks are available to do such things in a more elegant and efficient way?