Dependency Injection (DI) and Inversion of Control (IOC) fundamentals

Dependency Injection (DI) and Inversion of Control (IOC) fundamentals

A. What is Dependency Injection?

Dependency injection is the English abbreviation Dependcy Injection DI, DI will depend object is automatically handed over to the target object use, rather than subject themselves to get.

II. What is Inversion of Control?

Inversion of Control is Inversion of Control English shorthand IOC, inversion of control is a programming ideas, is a design pattern, but it does not belong to one of GOF23 design patterns. It is to reduce the degree of coupling between the tags. The most common way is to dependency injection (DI), as well as dependent lookup (Dependcy lookup)

III. Dependency Injection and Inversion of Control What is the relationship?

Dependency injection is one of the ways to achieve Inversion of Control, which is also dependent lookup

IV. Dependency Inversion principle what is?

Dependency Inversion Principle Inversion English is Dependce, abbreviated DIP, Dependency Inversion Principle refers upper module should not depend on the lower module, but depends abstract interface, it does not depend on the specific implementation, to reduce the degree of coupling procedures.

V. inversion of control implementations are those?

spring.net、unity、StructureMap、autofac

VI. Dependency Injection means of achieving those?

1. Constructor

2. Properties

3. Methods

VII. Way?

1. code implementation

2. Profile implement (recommended)

Guess you like

Origin www.cnblogs.com/zlp520/p/12015973.html