Class Central is learner-supported. When you buy through links on our site, we may earn an affiliate commission.

YouTube

How to Use Dependency Injection to Write Maintainable Software

Meeting Cpp via YouTube

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

Reviews

Start your review of How to Use Dependency Injection to Write Maintainable Software

Never Stop Learning.

Get personalized course recommendations, track subjects and courses with reminders, and more.

Someone learning on their laptop while sitting on the floor.