The essence of control inversion and dependency injection

Source: Internet
Author: User

Dependent elements: (1) relying party; (2) the relying party.

Dependency definitions:

1) Dependency rules, how to establish dependencies between two objects;

2) Determination of dependent objects (who depends on whom);

The principle of dependence is determined by (stable abstraction layer);

Depends on who the caller is to implement.

Http://www.digpage.com/di.html#di

The core of the IOC is to pass the instantiation of the unit (lower layer) on which the class (upper level) depends to a third party.

1190000002424023

The control of the dependency is reversed to the start of the call chain. This allows you to control the behavior of the dependencies completely, by adjusting the different injected objects to the control program.

Http://www.cnblogs.com/DebugLZQ/archive/2013/06/05/3107957.html

Object A gets the process of relying on object B, the active behavior becomes the passive behavior, and the control is reversed, which is the origin of the name "control reversal".

That is, the IOC container, so that a, B, C, D these 4 objects do not have a coupling relationship, the transmission between gears all rely on "third party", all the control of the object to the "third party" IOC container, so, the IOC container becomes the key core of the entire system

The essence of control inversion and dependency injection

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.