Overview
Discover effective techniques for managing dependencies through dependency injection in C++ at this Meeting C++ 2022 conference talk. Learn how to write decoupled, easily refactored, and testable components by exploring approaches to handle both data and behavior dependencies. Gain insights into managing multiple component dependencies, deferred instantiation using factories, and practical strategies for simplifying production code. Explore topics including constant and optional behaviors, passing dependencies, creating test fixtures, using shared and unique pointers, and implementing component hierarchies. Understand the advantages and potential drawbacks of dependency injection while improving code maintainability, refactorability, and testability.
Syllabus
Introduction
What is dependency injection
Data dependency
Constants
Behaviors
Bundles
Optional Behaviors
Passing Dependencies
Dependency Injection
Creating Fixtures in Test
Using a Shared Pointer
Using a Reference
piping
function arguments
translator and formatter
factory
unique pointer
shared pointer
advantages and disadvantages
sharing pointer
factories
wiring
component hierarchy
structs
Disadvantages
Testability
Conclusion
Taught by
Meeting Cpp