Author: czy
Di pattern (dependency injection) frees us from the sophisticated construction of the depended objects.
In the business view, it helps the developers concentrate on the business domain without any worries on the initialization of the depended objects.
In the architecture view, it facilitates the reuse of the component as the depended objects are resolved in the Di.
Let's take the design of teamview as an example.
There is a jiraimportcontrol to import the Jira system output XML to the teamview. The UML dimo-goes as following.
From the digoal, we can see the dependency between createdbform and jiraimportcontrol is quite neat.
We can easily move jiraimportcontrol to another container without much more coding than let the di construct jiraimportcontrol in that container.
However, if we give up Di, let's see what hell wocould be.
Without the Di's help, the additional dependencies come up to us. I admit that the some additional dependencies in the dimo-wocould be a little overstated. however, if we want to resue the jiraimportcontrol in another container, we have to take dbconnection construction and define construction (God bless that itemimporterimpl wowould have no dependencies) into consideration. if the other container can't supply the necessary parameters to the constructions, the design of container itself must be changed. so, the hell appears that changes happen over the system just to satisfy a little change in a little corner.
There are using perfect di framework, we use autofac as the Di.
Additionally, please go to our website novasoftware for more information about the team.