Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust Inversion of Control definition #37

Closed
wants to merge 6 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions docs/glossary.md
Original file line number Diff line number Diff line change
Expand Up @@ -215,12 +215,24 @@ IoC
See {term}`Inversion of Control`.

Inversion of Control
Inversion of Control is a complicated name for the simple idea of **lower-level** code (frameworks, data access layers, and so on) **invoking** our **higher-level** code: the business logic we care about.
Inversion of Control (IoC) is when a program invokes something without directly depending on it.
Instead, some form of indirection is used.

That's why it's sometimes called the *Hollywood Principle*: "Don't call us, we'll call you."

A critical consequence of that is that the *framework* can now take control of the services and make them available to the business logic it calls.
Usually, using {term}`dependency injection` or a {term}`service locator`.
Some libraries use inversion of control to allow pluggable third party behaviour.
Such libraries are often called 'frameworks'.
A framework is configured so that it *indirectly* calls code on which it has no direct dependency.

Inversion of control can be achieved using a few different patterns:

- {term}`Dependency injection`.

- {term}`Service locator`.

- [The Observer pattern](https://refactoring.guru/design-patterns/observer).

- [Webhooks](https://en.wikipedia.org/wiki/Webhook).

::: {seealso}

Expand Down