In Chapter 14, Configuration Files and Persistence, we suggested two application configuration design patterns:
- A global property map: In the previous examples, we implemented the global property map with a Namespace object created by ArgumentParser.
- Object construction: The idea behind object construction was to build the required object instances from the configuration parameters, effectively demoting the global property map to a local property map inside the main() function and not saving the properties.
What we showed you in the previous section was the use of a local Namespace object to collect all of the parameters. From this, we can build the necessary application objects that will do the real work of the application. The two design patterns aren't a dichotomy; they're complementary. We used Namespace to accumulate a consistent...