Compsoft Flexible Specialists

Compsoft plc

Compsoft Weblog Compsoft Website News Archive Privacy Policy Contact Us  

Friday, November 09, 2007

Tim Jeanes: Microsoft TechEd (Friday)

Today, at last, we got to see the new Microsoft MVC model in action. MVC (Model View Controller) is far from a new paradigm, but is Microsoft's first real venture into the MVC world. Thus we, the Microsoft fanboys, were about the only people in the room who weren't already using MVC in some other system.

I'm liking what Microsoft are doing here though - every step of the request/ response lifecycle can be swapped out, mocked for testing, or implemented by some completely other technology.

The full release of MVC for ASP.NET won't be out till midway through 2008, but the CTP release will be out in December 2007, and I just can't wait.

A major diappointment for me is that the first release will no real AJAX support at all. I guess I could hand-craft all my own javascript to make calls to the controller and receive JSON responses. That seems to be pretty well the only way of preserving the rich user experience that people want these days (short of mixing regular web forms pages in with the MVC model - which is totally possible, by the way). The question for me is whether or not it's going to be worth the effort. On the one hand I've put a lot of work lately into making our applications more user-focussed; on the other hand I've been frustrated for ages that we can't do any decent unit tests against the web projects in our solutions.


Our last session was on the power and weakness of reflection. We just love reflection - where performance is less of an issue, it's really handy for knocking out standard view or edit pages. This session took a much deeper dive into the power of reflection as well as how to generate code on the fly. This looks awesome! Using the new DynamicMethod class you can build your own methods at run time. You have to write it in IL - there's no C# here - which is pretty painful, but the free open source project "RunSharp" makes this a whole lot easier.

We've already been going to some length to improve performance by caching as much reflection as possible, but it looks like this can increase execution speeds by a factor of ten or more. The model we saw generated the code the first time it was needed, then cached it for re-execution later. This is fairly cute, but as Neil had just started playing with the BuildProvider class to hook into the compile process and generate code at that point, I think we'll end up using that: it means we can template C# code rather than using the more opaque IL, and also it happens at compile time, ensuring it's impossible to release un-executable code.


Seminars today: WEB05-IS (Matt Gibbs); GEN01 (Pat Helland); WEB04-IS (Matt Gibbs); WIN401 (Roy Osherove)

0 Comments:

Post a Comment

<< Home