I’m often asked about the Expression architecture, but have never found the time to really describe the whole thing. Now Paul Stovell has dug into how it works using Reflector and compares it to Composite WPF (Prism). Some of what he sees is a case of convergent evolution, though we did talk to the Prism guys at various times, and I think we had some influence.
Paul wonders why we didn’t use an IOC container. For one simple reason, when we started there were no general IOC containers for .NET. I also remain suspicious of “advantages” of an IOC container like support for circular dependencies, and like the simplicity of just using a heirarchy of strongly typed objects with properties and carefully managing your dependencies. As Paul theorizes, the IApplicationService is really easy to use because Intellisense and auto-completion works 99% of the time.
It’s strange to see people looking at IAddIn and AddInManager. I wrote that in 1 hour, 6 years ago, so we could run our test harness within our process. As far as I know the code has never changed (other than somebody renaming it to AddInService…). Warning to everyone who is looking at building Expression AddIns: none of the internal APIs are intended for anything beyond running the Expression tests and they *will* change with every release. We considered removing before we shipped, but it didn’t seem worth it because of the disadvantage of not being able to run our tests against the shipping version. Another Expression secret is the -diagnostics command line flag, which brings up internal perf and test tools. We could have removed those too, though I like being able to diagnose problems on customer machines.
If you read Paul’s article and wonder how Model-View-ViewModel fits with the architecture described, remember M-V-VM is a UI composition pattern. A lot of the stuff described is not UI specific, or if it is, can be considered to be the “Model” of Expression.
ps — There’s a bit of a “strange loop” going on, because Paul used Reflector to learn how Expression works on the inside…and many of the classes and concepts he’s looking at were designed by the same guy who wrote Reflector.