~/talk

Working with C++ Legacy Code

Talkat NDC Oslo 2017 · 2017-06-14..06-16· [c-and-cpp, legacy-modernisation]
slides:none on file

Shows a concrete workflow: write unit tests to capture behavior, then remove hard dependencies using Google Test and Google Mock, and finally refactor. Demonstrates faking an HTTP client and database in a distributed calculator and a TripService example, using template duck-typing to replace static/unmockable code and a replace singleton instance trick (via friend access) to inject test doubles. Tests run locally, failures reveal missing calls, and after applying these techniques the author gets passing tests and incremental, safe refactors.

AI-written summary · about

  1. 0:00Intro
  2. 3:20No longer engineered - continuedly patched
  3. 5:14Written by someone else
  4. 7:20The good news and bad news
  5. 9:07Gaining control over legacy code
  6. 11:56This is a unit test (GTest)
  7. 14:52A quick reality check
  8. 16:34Sensing and Separation
  9. 18:22The solution-fake/mock objects
  10. 19:20Fake objects using Google Mock
  11. 27:20Non virtual methods
  12. 37:54Problem: un-fakeable methods
  13. 41:48Using templates for injection
  14. 44:12Faking Private and Protected Methods
  15. 46:52Taking control of existing legacy code
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.