Topic
Dependency injection (DI) isn’t just for enterprise Java. DI is a simple, versatile design technique that can help you write less coupled, more modular, and more testable code. By the end of this talk, you'll be able to:
-
Spot implicit dependencies in your code
-
Understand what dependency injection is and why it matters
-
Apply simple DI in your Python code using functions or parameters
-
Know when not to use it
Outline
-
Motivation: Good Design and Why DI
-
Recognizing Dependencies
-
What is Dependency Injection (DI)
-
Dependency Injection (DI) vs Dependency Inversion Principle (DIP)
-
Practical Examples
-
Styles of Dependency Injection
-
DI for Testing
-
DI for Decoupling
-
DI for Flexibility
-
Composition Root: Where to Wire Dependencies
-
When Not to Use DI
-
Patterns that Use DI
-
Strategy
-
Factory
-
Service, Repository, and Domain
-
DI and Python Idioms
-
DI Containers and Frameworks for Large or Complex Projects