- Design all of the output display into two broad areas:
- Functions (or classes) that do no processing, but display result objects.
- Logging may be for debugging, monitoring, audit, or some other control. This is a cross-cutting concern that will be embedded in the rest of the application.
For this example, there are two outputs—the sequence of sequences, and some additional information to confirm that processing worked properly. A count of each number rolled is a handy way to establish that the simulated dice were fair.
The sequence of rolls needs to be written to a file. This suggests that the write_rolls() function is given an iterator as a parameter. Here's a function that iterates and dumps values to a file in YAML ...