Working with C++ Legacy Code
summary
Shows concrete techniques to make C++ legacy code safe to change: write automated tests with Google Test and replace dependencies with Google Mock or hand-written fakes; hack singletons via a test-only accessor and use templated dependency injection to replace static or final classes; demonstrates on a TripService kata where tests run and protect refactors. Notes real-world horrors like 10,000-line methods, uses Resharper for C++ on Windows, and argues incremental tests-first refactoring reliably reduces risk.
AI-written summary · about
chapters (17)
- 0:00Intro
- 3:04Legacy Code
- 4:09Legacy Code Properties
- 4:39Continuously patched and hacked
- 6:23Broken features
- 7:57Who wrote the code
- 9:04Legacy Code has users
- 12:06The simple algorithm
- 15:57The Google Test
- 17:35Fake Objects
- 19:26Inheritance
- 27:07Problems
- 28:36Singletons
- 33:41Static Methods
- 39:15Private Methods
- 40:41Other Tricks
- 45:05Conclusion
related talks
49mWorking with C++ Legacy Code
01h 01mYou Can Test Anything
01h 31mClean(er) Code for Large Scale Legacy Applications
01h 23mInvestigating Legacy Design Trends in C++ & Their Modern Replacements
58mWho Needs C++ Unit Tests Anyway? - Modernizing Legacy Code with 0% Code Coverage
38mSurgical Refactoring of Non-Tested Code – A Worked Example
55mSo, you inherited a large code base...
16mSecuring Your Legacy Rewrite with Capture and Characterization Tests
