views:

77

answers:

3

I want open source assemblies with interfaces (but no implementations) of common things, such as logging, IoC/DI, etcetera. If this exists, it would be easier to mix and match bits and pieces of things together without having to write too much glue code.

Example: If this existed, I would be able to for example create a asp.net mvc application and add any ORM, logging and IoC framework. I could then drop in references to third party assemblies with controllers and models and they would play nicely together. If I write my own interfaces, I would have to modify each of these. I don't want to modify, I want to 1. drop in, 2. configure and 3. use! Simple as that, shouldn't be harder.

Have you heard/used/written of something like this?

A: 

I don't think such assemblies exist. If you are lucky, the libraries that you decide to use define their own interfaces that they then implement - such as Windsor containers implementing the IWindsorContainer interface.

However, if you were to use a different DI Container, you couldn't reuse that interface, since, say, StructureMap doesn't implement IWindsorContainer.

In any case, I don't see what the point of such a library would be. You can write an interface in a few minutes time. It's not the interfaces that take up your development time - it's the implementation.

Define whatever interfaces you need in your own application - they will also be more targeted and carry less redundancy in that case, because you will only need to define exactly the properties and methods you need for that application.

Mark Seemann
Please see the updated question. I want the interfaces separate from any implementation, so that any bit and piece can use it.
svinto
Yes, I understand that, but to the best of my knowledge, such a thing does not exist, for the reasons I outlined above: No libraries implement such interfaces, so they would provide no value whatsover. However, no-one stops you from implementing such a library yourself - that might be a worthwhile OSS project.
Mark Seemann
Could you expand on why such a library would provide no value? (I do realize it would be useless if no-one used it for their implementation.)
svinto
If lots of library implementers were to actually implement interfaces defined by a hypothetical universal interface library then it would be valuable. That is just not the case at the moment, and not very likely to be any time soon.
Mark Seemann
+1  A: 

There's a project called Common Infrastructure Libraries for .NET that looks similar to what you're asking for. At this point however, only a logging abstraction is available.

As Mark recommends, defining your own interface isn't a bad thing - then your interfaces make sense for your applications, and your use cases. If, later on, you find an open source, general purpose abstraction for some concept/component, you can then either refactor your code to use it, or simply adapt it to your existing interface.

While in theory a common abstraction is a good idea - right now, for many "common things", there isn't an accepted "common approach".

Nader Shirazie
A: 

IoC frameworks can be decoupled using the CommonServiceLocator: http://www.codeplex.com/CommonServiceLocator

svinto