You’ve probably never heard of Yadic. It’s the smallest DI container I’ve seen. I’ve linked directly to the only source file because it’s a good read, even if Google Code can’t do syntax colouring for F#. It’s more opinionated than a party political conference and has some neat ideas. One of them is the concept that you can specify that a service be decorated.
Let’s just run through that again: you can take a service and stick a decorator on it. Now, you may be thinking that you can already do this in most containers, and you can but it’s slightly painful. You need to rename the original instance, register the new instance under the old name and then set up an explicit dependency for the constructor parameter. It gets worse if the original registration didn’t have a name. (Yadic, of course, doesn’t allow you to have multiple implementations of the one service. I did say it was opinionated…)
Castle Windsor, the container I know best, already has this feature, but it doesn’t know it. The interceptors feature provides the same functionality, but ties it to the use of DynamicProxy. As a consequence, it tends to be seen as an extremely technical aspect of the implementation. It exposes the “How”, but not the “What” or the “Why”.
It also demonstrates something quite surprising: there’s still room for innovation in the IoC container space. Containers haven’t changed much in the last five years, but they’re much less of a solved problem than it might appear and there’s still a need for revolutionary thinking. Obviously, I’ve got form on this, but I don’t think the container of 2020 will look much like the container of 2010. If any of us are still using statically typed languages, that is…
Postscript: I’ve been telling Christian to blog for some time, but to date he’s only made one post. Mark Needham has tried a new approach to getting his thinking to a wider audience. It’s got merits… 🙂