I have a requirement where I have a big list of operations that are owned by external agency. I need to perform these operations one by one and record the outcome. Once this is done I need to return the list of outcomes.
Here is the algorithm (not java code, just high level design):
doStart
operation 1
operation 2
operation 3
operation N
return List<results>
Here results is the type of output of all operations and added to list after the call to each operation.
Since the operations are completely controlled by external organization, we don't have a control over it and it may change frequently.
I am looking for a pattern for core java where I can plug these operations one by one for example register them somehow at run time, and change on the fly. Add new ones dynamically, modify one operation without affecting other and reduce duplicate code.
Right now as per above class design, its very difficult to achieve these. Any single change in operation affects the entire design.
Please suggest some effective solution.
Aucun commentaire:
Enregistrer un commentaire