I would like to know how would I break a project into multiple jar files if I have many factory classes as below:
class Reconciler {
public void process() {
AbstractOperatorX opX = OperatorXFactory.getInstance(reconcilerName);
opX.perform();
.....
AbstractOperatorY opY = OperatorYFactory.getInstance(reconcilerName);
opY.perform();
......
AbstractOperatorZ opZ = OperatorZFactory.getInstance(reconcilerName);
opZ.perform();
....
}
Let us assume there are
- Two implementations of AbstractOperatorX viz. DeviceOperatorX and CardOperatorX, to returned by OperatorXFactory.
- Two implementations of AbstractOperatorY viz. DeviceOperatorY and CardOperatorY, to returned by OperatorYFactory.
- Two implementations of AbstractOperatorZ viz. DeviceOperatorZ and CardOperatorZ, to returned by OperatorZFactory.
Now if I have to deploy this project in the best modular way, I think I can decompose it into following jars:
- reconciler-framework.jar which has class Reconciler
- reconciler-operation-utils.jar which has classes AbstractOperatorX, AbstractOperatorY, AbstractOperatorZ
- device-reconciler.jar which contains DeviceOperatorX, DeviceOperatorY, DeviceOperatorZ
- card-reconciler.jar which contains CardOperatorX, CardOperatorY, CardOperatorZ
- factory.jar which contains OperatorXFactory, OperatorYFactory, OperatorZFactory
Thus tomorrow, if a Port Reconciler comes up, I need to change only factory.jar and NO OTHER jar. Is this the right way to modularize the jar files or is there a better way. Or am I modularizing it too much.
Aucun commentaire:
Enregistrer un commentaire