I've been tasked with designing a sizable Java / Swing based project with about 200 use cases.
This is my usual design solution:
- Create a simple Operation class for each Use Case that validates and executes the business logic;
- Create a Controller with public methods for all of the Use Cases that constructs, validates and executes the appropriate Operation;
- (for the sake of brevity I won't discuss Operation execution queues or UI notification mechanisms that the Controller also implements).
This design has worked well for me in the past because it allows all of the Use Cases to be individually unit tested and provides developers with a single Controller that satisfies all of the Use Case logic.
This is my problem:
My usual design WILL fail me because the new project requires many input dialogs, most with inline table editing.
These dialogs will require the same data validation and business logic that the Operations provide, however changes to the dialog must not be committed to the database until the dialog's OK button is clicked.
I desperately do not want developers to implement (and maintain) the same complex validation and business logic more than once, however I am unsure how to reuse Controller Operations that don't modify the underlying database / data model.
Does anyone have any solutions that have worked for them in the past?
I am hoping to hear from people that can truly appreciate this problem and have actually solved such issues.
I will be forever in your debt if you have advice to share.