Skip to content

About inversion of control

Alberto edited this page Mar 15, 2022 · 2 revisions

Inversion of control means, roughly, "Don't call me; I call you". Someone's else code up there call your code. calling a function within a function is not inversion of control. The inversion of control is related with the structure of your code.

  • If you have code that, since the beginning , the execution flow is clearly visible, and the specifications of what your code does are more or less followed in the flow, and each step of the flow are composed of formulas and algebraic expressions of some kind like numeric formulas database queries etc, that perform effects or not, that can be aggregated in different ways and reflect the logical structure of each problem, then you don't have inversion of control.

  • If your code is a set of disjoint handlers that are called by some framework, they you have inversion of control.You have to split your code according with the idiosincrasia of the framework.

Clone this wiki locally