Simple Design
If you knew nothing whatsoever about design, you might consider following three simple rules when practicing TDD.
-
Ensure your code is always highly readable and expressive.
-
Eliminate all duplication, as long as doing so doesn’t interfere with the first rule.
-
Ensure that you don’t introduce unnecessary complexity into your system. Avoid speculative constructs (“I just know we’re gonna have to support many-to-many someday”) and abstractions that don’t add to your system’s expressiveness.
The final rule is important, but the other two hold slightly higher priority. In other words, prefer introducing an abstraction such as a new member function or class if it improves expressiveness.
Following these rules can give you an eminently maintainable ...
Get Modern C++ Programming with Test-Driven Development now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.