Skip to article frontmatterSkip to article content

What is Dependency Injection?

Dependency injection
Receiving dependencies (functions, classes, etc.) as inputs instead of importing them directly.

Instead of

1
2
3
4
import plugin

def application():
    plugin.compute()

we have

1
2
def application(plugin):
    plugin.compute()