Let's add a feature to our blackjack simulation: analysis of results. We have several paths to implement this added feature. There are two dimensions to the considerations that we must make, leading to a large number of combinations. One dimension is how to design the new features:
- We can add a function and work out ways to integrate it into the whole.
- We can use the Command design pattern and create a hierarchy of commands, some of which are single functions and others of which are sequences of functions.
Another dimension of the design that we must consider is how to package the new features:
- We can write a new top-level script file. This tends to create new commands based on filenames. We might start with commands such as simulate.py and analyze.py.
- We can add a parameter to an application that allows one script to perform either the simulation...