May 30, 2014 07:01 AM|Tarwn|LINK
First, I am in agreement with everything Ploeh has said so far and I would throw in another point that I didn't see explicitly in his posts.
The top-most goal is to make a framework for developers to consume. Overgeneralizing this structure not only offers the potential for leading developers into bad practices, it also hinders their ability to adopt it. By making the construct this general,
it doesn't communicate to the user any more. A search for
ITypeActivator is going to have far less relevant results than a search for
IXyzControllerFactory, it's going to be more obvious what to expect when you see an instance of
IXyzControllerFactory defined, and
IXyzControllerFactory in a class definition gives you information that you would otherwise have to scan through a long file (containing all the objects) to obtain.
IXyzControllerFactory is more restrictive. It has a specific purpose and it speaks directly to that purpose alone. This is not a bad thing. Unnecessary generalization introduces all sorts of cases that the framework isn't
expecting and I guarantee there are going to be projects out there misuing the ITypeActivator interface for their own uses (and then getting stuck in two versions when you pull it out or need to change it).
The consumer for this framework is people, not computers. Overly broad generalizations may cut some hours off the development of the framework, but the consumers (people) are going to each lose at least as much time as you gain by going this route.
Now that Ploeh has brought this to my attention, I'm going to have to go see how much non-value added work this is going to add to my team's plate when it is released. We have a profitable, long term product and we refuse to choose the "just stop upgrading
and take the long term support plan" path, so every time there is a breaking change we have to invest in rework. It's unfortunate so many of these changes seem aimed at green field projects.
I'm interested in the additional goals as well, as perhaps we can find an alternative route with fewer or more palatable sacrifices.