Jul 05, 2014 02:27 PM|mystere|LINK
I definitely agree with you in places but I think we'll just have to agree to disagree with regards to the Controller factory - I see what you're saying but I just don't see it as a problem :)
You don't see it as a problem that if I want to use a DI container, i'm forced to give up many of my extension points? I see DI container support as being an integral part of an application framework these days. ControllerFactories were not created to
add DI support, they were created to provide flexibility to the application developer. If I want to use a container *AND* I want to have my own controller factory. Even worse, let's say i'm a library author, and as part of my library, it includes a cool
controller factory. Now I have to implement a version for every container out there. If DI container support is built-in, then I need only call the framework provided interface to the container the user has chosen and I can support all containers with one
piece of code.
I'm not sure why but I feel uneasy about a container in the framework "reaching out" to my code. It looks like the framework is going to have some all powerful object that you say: "Hey champ, when one of my controllers asks for IMyService can you give them
this MyImplementation?". Why do I have to configure the framework to know how to resolve my controller's dependencies? Why should it care? All it needs to be able to do is create one. I know how to create my controllers, (possibly using a container to resolve
dependencies) why shouldn't I just give the framework a factory that it can use?
You're uneasy because you are basing your opinion on incorrect assumptions. That's not what it is at all. It has a conforming container *INTERFACE*. Not that different from what MVC has today. However, unlike what they have today, they will also be providing
a basic, simple, default container, which you do not have to configure if you don't want to, and don't care. You can replace this container with whatever you want if you do care. The framework doesn't force you to use a container.
I suggest you read