Chapter 9: Program Analysis Tools
Producing high-quality code is not an easy task, even for very experienced developers. By adding tests to our solution, we reduce the risk of making obvious mistakes in the business code. But that won't be enough to avoid more intricate problems. Every piece of software consists of so many details that keeping track of them all becomes a full-time job. There are dozens of conventions and multiple special design practices agreed upon by teams maintaining the product.
Some questions relate to consistent coding style: should we use 80 or 120 columns in our code? Should we allow std::bind
or commit to Lambda functions? Is it okay to use C-style arrays? Should small functions be defined in a single line? Should we insist on using auto
always, or only when it increases readability?
Ideally, we also avoid any statements that are known to be incorrect in general: infinite loops, usage of identifiers reserved by a standard library, unintended loss...