This document discusses refactoring C++ code to make it easier to test. It begins by describing hard-to-test code patterns like tight coupling, dependence on global states, and high complexity. It then discusses refactoring techniques like abstracting dependencies through interfaces, injecting dependencies, and avoiding hard-coded values. The document provides examples refactoring files, odometers, timers, and domain logic to be more testable. It concludes by emphasizing writing unit tests that are fast and focus on verifying code through abstraction and injection.
Related topics: