Compile- and Run-Time Dependency Injection - Marius Feilhauer - C++ on Sea 2022
Вставка
- Опубліковано 2 жов 2024
- C++ on Sea Website: cpponsea.uk/
C++ on Sea Twitter: / cpponsea
---
Compile- and Run-Time Dependency Injection - Marius Feilhauer - C++ on Sea 2022
Slides: github.com/phi...
Creating and managing dependencies sustainably is a challenge every software developer stumbles across. C++ offers different possibilities to realize dependency injection.
This talk is based on our experience of handling dependencies in a large embedded software project while maintaining its components and test suite.
The presentation provides practical insights of how to apply dependency injection.
It focuses on
- Different techniques for managing dependencies with C++
- Unit Testing and different seams to inject fakes
- Lessons learned on usability of the different approaches
- Runtime performance
---
Marius Feilhauer
I'm a passionate C++ software developer who studied automotive engineering and got a PhD on Simulation-based validation of advanced driver assistance systems. If not enjoying music or time with my family I'm working on autonomous mowers and holding lectures on software development at the University of Stuttgart.
---
C++ on Sea is an annual C++ and coding conference, in Folkestone, in the UK. The 2022 conference was conducted as a two part, physical and online C++ event.
- Annual C++ on Sea, C++ conference: cpponsea.uk/
- 2022 Program: cpponsea.uk/20...
---
Produced and Edited by Digital Medium Ltd: events.digital...
Enquiries: events@digital-medium.co.uk
#Programming #CppOnSea #dependencies
Better for compile-time:
A) take ownership of the interfaces via std::move
or B) only give types, e.g. alarm()
and C) Stihl chainsaw > Occam's razor
Hello, nice talk, but I don't understand (12:17) time_interface depends on chrono, is that right?, I think an interface shouldn't depend on nothing
The chrono dependency is needed for the type of the time point. You could create you new custom time point class, or an interface for that, too, but that is not necessary here and would be a lot of glue code. I think only when you actually need a different time implementation (other than for the test) that doesn't work with chrono time points that would be relevant.
Headers are also interfaces
Very good talk. Nice examples. However the abstract class definition is buggy. Destructors need to be declared as virtual to avoid memory leaks.
Great talk, clear, instructive and in just about half an hour.
Glad it was helpful!