Skip to content

Dependency Injection, Inversion of Control, and You

Notifications You must be signed in to change notification settings

python-spokane/di-ioc-and-you

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

marp theme
true
gaia
<style> .yellow { color: #ffee00 } strong { color: #ffee00 } section { background: #111111; color: white; } </style>

DI, IoC, & You

Dependency Injection, Inversion of Control, and You

October 17, 2023


Outline

  1. Inversion of Control
  2. Dependency Injection
  3. django-di

What is Inversion of Control?

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)


What is Inversion of Control?

Instead of

your code => library

with IoC

your code <= library (inverted)

Examples of Inversion of Control

  • Tkinter
  • unittest (setUp, tearDown, ...)
  • Django views (called by Django framework)

What is Dependency Injection?

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>

width:800px


<style scoped> section { background: white; } </style>

width:800px


<style scoped> section { background: white; } </style>

width:800px


What are some benefits of DI?

  • Decreased coupling
  • Testability
  • Composability ("has a", not "is a")

Auto Dependency Injection

Taking things a step further with DI Containers


Summary

Zupah kewl summary


Questions?


Thank you all for coming! 👋


References

About

Dependency Injection, Inversion of Control, and You

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published