Inversion of Control

noun

say it: “in-VUR-zhun uv kun-TROHL” /ɪnˈvɝʒən əv kənˈtroʊl/

A framework calling your code when it decides to, instead of your code calling a library when it wants.

What is inversion of control?

Inversion of control is the twist that makes a framework a framework. With a library, your code is in charge: it calls Math.Max when it wants. With a framework, control is turned around: the framework runs, and it calls your endpoints, your middleware and your constructors when it decides. It's nicknamed "don't call us, we'll call you".

In a sentence

  • “Nobody in our code calls the endpoint; with inversion of control, the framework does.”

Level: Journeyman · More OOP terms at this level

Updated