MS MVC – A MonoRail Perspective

Scott Guthrie gave us our first look at the the new Microsoft MVC framework at ALT.NET. I took special care, while watching the video, to answer one question.What, if anything, can MonoRail learn from MS MVC?

  1. Routing – RoR and MS MVC treat Routing as a first class citizen. Routing in MonoRail is an after thought and it shows.Why is first class Routing a big deal?
    • DRY – Tight integration between the routing engine and URL generation allows URLs to refactored easily and safely.
    • Testing – Testing routes, in MonoRail, requires an end-to-end test. If routes were first class objects, then routes could be tested in isolation.
  2. Typed PropertyBag – Typed PropertyBag is not the default behavior in MS MVC, but it is supported.Why is a Typed PropertyBag important?Contract – A Typed PropertyBag communicates the contract between the controller and view. Without this contract, refactoring anything in the view or the controller is difficult and error prone. We enforced a contract by implementing Advocates, but it would be nice if it were supported by MonoRail.

What are your thoughts?

Advertisements

5 Responses

  1. The lack of a strong-typing between the view and the controller was one of the things that concerned me about MonoRail as it is ever-so easy to mistype and have things go wrong in the field at runtime.

    [)amien

  2. I agree on the routing part. I do not think it will be very difficult to provide a better implementation of IUrlBuilder and IUrlTokenizer that does this.

    My biggest reason for wanting it is to be able to have named routes ala blogs_url or posts_url. We can get close today using the CodeGenerator but it doesn’t handle the Restful urls very well.

    If you want typed PropertyBag check out the DictionaryAdapter in castle components. You won’t have the inttelisense in your view, but you will be passing an interface.

  3. You get intellisense in AspView. 😉

  4. @Damien I think in practice a typo like that wouldn’t happen very often as it would quickly be caught before deploying, probably in one of your tests.

  5. Agree totally about routing. RoR does this so beautifully.

    Not sure why you want the PropertyBag to be typed? I appreciate NVelocity’s ability to iterate over any kind of collection without fuss, and often change between collection types during refactoring, without needing to worry about how the template will handle the change.

    One thing I’d like to see it the option to have ActiveRecord spit out Generic Lists rather than arrays, which are awkward to handle in C# compared to Ruby.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: