David Benson

    I've been a software engineer professionally for 30 years, mostly in C++. For the last 20 years, I have worked for S&P Global on financial applications.

    Sessions

    • Hijacking singletons to enable unit testing of legacy code

      Intermediate
      Testing

      A common trait of legacy code is that it doesn't have unit tests and can't be easily adapted to enable unit testing because the code wasn't structured to use Inversion of Control and Dependency Injection. Instead, the code frequently makes use of singletons to access things that we would like to mock like database or network calls. By hijacking our singletons we can allow for mocking of external dependencies.