marp | theme |
---|---|
true |
gaia |
Dependency Injection, Inversion of Control, and You
October 17, 2023
- Inversion of Control
- Dependency Injection
django-di
The idea that a library calls your code instead of you calling a library (framework).
Don't call us, we'll call you (Hollywood's Law)
Instead of
your code => library
with IoC
your code <= library (inverted)
- Tkinter
- unittest (
setUp
,tearDown
, ...) - Django views (called by Django framework)
An IoC technique for separating construction from use.
We pass a class its dependencies instead of creating them within the class.
$10 word for a 5𝇍 concept
<style scoped> section { background: white; } </style>
<style scoped> section { background: white; } </style>
<style scoped> section { background: white; } </style>
- Decreased coupling
- Testability
- Composability ("has a", not "is a")
Taking things a step further with DI Containers
Zupah kewl summary