共用方式為


Expression architecture

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. 

https://www.paulstovell.com/blog/expression-framework-versus-composite-wpf

 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.

Comments

  • Anonymous
    October 17, 2008
    I would also find a review of the Visual Programming Language of Microsoft Robotics Studio to be very interesting. Do you have any comments on the design and challenges faced with that project?

  • Anonymous
    October 20, 2008
    I wish I had Paul's free time... I'd add one cautionary note: Looking at how others do things is cool, but experimentation and prototyping is essential to good design decisions.  E&P has been way more useful than Prism guidelines. My biggest fear of guidelines is that they encourage "meeting some specification".  Goals-as-targets is a poor formula for quality.  Who decides the goal?  Somebody, arbitrarily.