Dependency inversion principle, control inversion, and dependency injection

Source: Internet
Author: User

1. Dependency Inversion principle:

1) The upper module is not dependent on the underlying module, but is dependent on the abstract module (or interface).

2) Abstract things cannot be figurative, and figurative depends on abstraction.

2. Control inversion (inversionof controls):

is a behavior when the software is running. For example, object A relies on object B, but in B it is not just to create a, but to get a from outside. So

An object does not go directly to create it so it relies on other objects.

3. Dependency Injection (Dependency injection):

is a concrete implementation of control inversion. As stated above, the creation of a is not created directly in B, but is done through a constructor or property setting through certain frameworks (such as Autoface).

  IoC, which passes the invocation of objects traditionally manipulated directly by the program code to the container, implements the assembly and management of the object components through the container. The so-called "inversion of Control" concept is the control of the Component object.

Transferred from the program code itself to the external container.

Dependency inversion principle, 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.