Designing an interface
Having spent some time with the two implementations, we are now able to start designing the interface. Skipping ahead to this stage might be problematic since we don’t know what kind of constraints we need to place on the interface, what parameters need to be passed, and what structures are needed to facilitate the loading. We’ve learned already that the JSON library supports an abstract stream interface but the CSV library does not; thus, passing the file as an ifstream or other file descriptor will not be sufficient. We will have to pass a valid filesystem path. If we don’t want implementation details to leak, we’re also limited in what supporting functions can be added to the class itself. This isn’t really a concern here because the file readers library is so small, but in larger libraries, this might be important.
To add the interfaces to the project, we’re going to add an additional directory to the project...