Fickle Bits

You're doing it wrong.

ASP.NET MVC - Preview 2 Thoughts

I said previously that I was excited for this release.  Ultimately I didn’t see much worth blogging about.  Some features are a step in the right direction, some (I think) were a step back.

I’m currently upgrade Code Camp Server to Preview 2 and hit about 80 errors which I had to go in and resolve.  My initial thoughts:

  • I think the HttpContextBase is a bad idea.  Yes I understand the desire to not introduce breaking changes.  But I think that the people that will be using ASP.NET MVC will be congnizant of this and code appropriately.  Interfaces are much easier to depend work with while testing, and I’d rather just use those.  Hey, couldn’t they give us both, and framework providers could choose?
  • what’s up with the OnActionExecuting, OnActionExecuted events?  These used to be OnPreAction, OnPostAction, which was much more readable (in my opinion) — seriously, put these back!  The new naming is not nearly as obvious to the glance.
  • Testing is still too cumbersome.  I think some good mocking-fu can mitigate this, but it’s a tough sell to people new to unit testing (and to mocking).  TempData should be implemented as an IDictionary on the controller, only to have a real TempData that depends on session state at runtime.  This would allow me to test that TempData works without having to mock session (which is not intuitive at all).
  • The Action filters are going to be where the goo lives.  This is how we will see some really productive & handy filters for performing actions such as requiring SSL, protecting an action from unauthenticated access, loading common data, etc.  Think of them as HttpModules for individual actions.

More to come, I’m sure…

 

 

Comments