We started with a solution that solved the problem at hand. After creating a basic pipeline, we created an elaborate pipeline, which made the solution extensible. Now we can add new commands without recompiling the application. This is very important in the case of applications that are governed by amendable laws. To make our code robust, we will add the design by contract strategy to our command objects.
The design by contract idiom, created by Bertrand Meyer (creator of the Eiffel language), extends the ordinary definition of abstract data types with preconditions, post conditions, and invariants. To execute any contract in real life, we need to satisfy some preconditions, followed by execution, and a post execution (verification) phase as listed here:
- Pre-Execute
- Execute
- Post-Execute
At the end of the Post-Execute phase, the invariants are checked to see whether they are violated. The consumer will call PreExecute
to determine...