What is Inversion of Control?

前端 未结 30 3279
清歌不尽
清歌不尽 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:31

    I agree with NilObject, but I'd like to add to this:

    if you find yourself copying an entire method and only changing a small piece of the code, you can consider tackling it with inversion of control

    If you find yourself copying and pasting code around, you're almost always doing something wrong. Codified as the design principle Once and Only Once.

提交回复
热议问题