liveBook · Manning

Inversion of control

As explained in Grokking Software Architecture

Inversion of control is a design principle in which control over object creation or execution flow is transferred from a component to an external mechanism.

Inversion of control keeps checkout logic from depending directly on a low-level HTTP library or URL: inject a service instead of hardcoding the dependency. This avoids putting business logic at the mercy of a specific library; the implementation details are not shown. section 10.4.1

How Grokking Software Architecture covers it

How deep it goes
Identifies hardcoded dependencies as an IoC violation and recommends service injection, but gives no implementation steps.
Examples
Uses checkout code with a hardcoded HTTP call and URL, noting the difficulty of adding another provider or logger.
What you can do after
Evaluate checkout code for hardcoded low-level dependencies and choose service injection as the remedy.
How it connects
Connects IoC to dependency inversion, SOLID principles, and service layers.

Also explained in

Compare how 5 books explain inversion of control →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Grokking Software Architecture. The section links point to the parts of the book it draws on.