Welcome Guest, Not a member yet? Register   Sign In
Dependency injection
#5

[eluser]xwero[/eluser]
What if you load one model in the other and at one point during the apps/sites lifetime you or another developer changes the controller because a method from the internal model to be called. Because the internal model isn't visible you are likely to try to reload that model again. The loader method will prevent this but it's one call that isn't needed.
What if later on data from somewhere else in another method has to be injected with the data from the method you use the other models controller in.

Next to making your code more maintainable, by flexibility, Dependency injection makes things more visible in the long run too. It doesn't matter if it is an object with methods or just data.


Messages In This Thread
Dependency injection - by El Forum - 03-27-2009, 04:35 AM
Dependency injection - by El Forum - 03-27-2009, 05:48 AM
Dependency injection - by El Forum - 03-27-2009, 06:03 AM
Dependency injection - by El Forum - 03-27-2009, 06:13 AM
Dependency injection - by El Forum - 03-27-2009, 07:45 AM
Dependency injection - by El Forum - 03-27-2009, 08:09 AM
Dependency injection - by El Forum - 03-27-2009, 08:13 AM
Dependency injection - by El Forum - 03-27-2009, 09:20 AM



Theme © iAndrew 2016 - Forum software by © MyBB