Summary
This chapter covered several challenges of modularizing code and making your code available to others (or possibly just yourself) to reuse in the future. In the first section, we talked about static and shared libraries, and some of the things that should be considered when building these, especially shared libraries. Next, we talked about C++ modules, which are conceptually a more efficient replacement for header files. However, compiler support is a little lacking, and there are many technical problems with these that don’t have compelling answers right now. In the final section, we reviewed how to divide a large project into smaller parts using CMake to reduce the cognitive burden of understanding the library and make it easier to test the internal mechanics of your libraries.
The main point of this chapter is that designing and maintaining (re)usable code is its own challenge that needs to be thought through carefully. At a basic level, this involves designing...