~/talk

Compile- and Run-Time Dependency Injection

Talkat C++ on Sea 2022 · 2022-07-05..07-07· [software-architecture, c-and-cpp]
links:none on file
slides:none on file

Compares runtime dependency injection via abstract interfaces to compile-time dependency injection via templates using an alarm clock example wired to std::chrono and std::cout; introduces time fake and output fake so tests advance time instantly instead of waiting 10 minutes, making unit tests fast and verifiable. Runtime DI keeps swap-at-runtime and clear interface contracts but pays virtual-call overhead; compile-time DI removes virtual calls (useful in embedded hotspots) but requires concrete types at compile time. Demonstration runs on Compiler Explorer with 25 ms/10 ms demo values.

AI-written summary · about

  1. 0:00Introduction
  2. 1:02Speaker background
  3. 3:28Talk overview
  4. 4:13Alarm clock example
  5. 6:48Naive implementation
  6. 10:20Runtime dependency injection
  7. 19:10Compile-time injection
  8. 26:03Pros and cons summary
  9. 28:33Code review and Q&A
~/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.