My application has many modules and the original business flow looks like this:
A -> B -> C -> D
As the application grows, alternative flows are added to satisfy customers’ need:
A -> B -> C -> D
A -> B -> C’ -> D (C now can perform optional operations)
A -> D
A -> D’ (D now can perform C’s optional operations)
The numbers of unit test cases and QC’s manual tests rocket.
Current I have 2 solutions:
- Silently create B, C from A before giving it to D, then I can guarantee the number of inputs to D
- Skip B, C, adjust the input of D to a mediate type and write Adapter to convert the A -> mediate type
The chosen solution must meet below objectives:
- Flexible business (for customer)
- High processing performance
- Maintenance (source code)
I have no idea which one I should use or there is any better solution.
First, I am not entirely sure I understand your problem, so let me state my assumptions and then provide my answer. Adapt as necessary.
Assumptions:
If this is the case, I would ensure that I had a proper understanding of my data model, and which parts each of the steps would operate on, and then build a state machine around this.
Benefits:
Things to keep in mind:
I have successfully employed this way of modelling a business flow in a previous project. It was a flow where end users could purchase objects. We needed to handle lots of alternative flows, such as switching between different ways of payment, retries when backend systems were unavailable and so on.
We rolled our own state machine framework for this to suit our needs. You should probably look at what is available for your platform.