Posts

Showing posts from August, 2023

Configuration

 In principle, managing configuration -- via the environment, the command line, database lookups (note from experience: great for keeping one copy across multiple systems, frequently a massive pain when doing diagnostics on production problems when you don't have access to production), or flat files should really be handed off to something like boost or another third party library. All the problems involving configurations have been met and surmounted many times before. But the point of this exercise was not to farm out functionality to boost (on any large scale), but to exercise modern coding skills. So, of course I built a basic config file parser.  However, it's in XML rather than the old-fashioned line config file model, which allows a certain amount of extra flexibility to be built into the structure.  This also means that keys and values can include spaces. This is another class that is over in general utilities, not in the immediate project. class ConfigFileReader ...

FullOfficeAssembler

The Generator is not the top level of putting office information together.  That is done by the FullOfficeAssembler, which makes use of an implementation of IFullOfficeGenerator, but also uses the date subsystem to determine the values to retrieve, as well as the use followed. class FullOfficeAssembler { public:   FullOfficeAssembler(const IDayRecordSource &inRecordSource,                       const IDateCalculator &inDateCalculator,                       const IFullOfficeGenerator &inGenerator,                       const IKalendar &inKalendar, const IPsalter &inPsalter,                       const Use inUse):       m_recordSource(inRecordSource),       m_dateCalculator(inDateCalculator), m_generator(inGenerat...

Assembling Partial Data Into Full Offices

To create a complete office, we need to handle anything between one and three general or partial models with appropriate logic for combining them.  This work is split into two levels. The first level handles the actual output of the data, and the various sets of conditions governing their combinations: class IFullOfficeGenerator { public:   virtual ~IFullOfficeGenerator();   virtual void   generateFromSingleSource(const IOfficeInfoSource &inSource,                            const IHoursInfo &inGeneralInfo) const = 0;   virtual void   generateFromCombinedSources(const IOfficeInfoSource &inBaseSource,                               const IOfficeInfoSource &inDerivedSource,                               const IHoursInfo &inG...