Input & Output

Make input and output modules

Output requirements are subject to change without notice. Input format and content are subject to change and often messy. Localizing the code that deals with them improves maintainability. Avoid mixing input or output code with computation, except for preprocessing, in a single function. Mixed purpose functions are unlikely to be reusable.

Format output for easy use

If the output will most likely be read by a human, make it self descriptive and easy to read. If the output is more likely to be read by software than a person, make it easy to parse. If both are important, make the output easy to parse and write a formatter function to produce a human readable version.