What is Inversion of Control?

前端 未结 30 2845
清歌不尽
清歌不尽 2020-11-22 00:13

Inversion of Control (IoC) can be quite confusing when it is first encountered.

  1. What is it?
  2. Which problem does it solve?
  3. When is it appropria
30条回答
  •  一向
    一向 (楼主)
    2020-11-22 00:41

    For example, task#1 is to create object. Without IOC concept, task#1 is supposed to be done by Programmer.But With IOC concept, task#1 would be done by container.

    In short Control gets inverted from Programmer to container. So, it is called as inversion of control.

    I found one good example here.

提交回复
热议问题