Fubu MVC 


Here are notes from the FubuMVC talk that Chad Myers gave with assistance from Jeremy Miller.

 

Video of the first half of the presentation:

AltNetHouston: FubuMVC from Weston M. Binford III on Vimeo.

Fubu MVC - altnethouston from Ben Scheirman on Vimeo.

 

Fubu MVC - audio from Mohammad Azam

 

Why FubuMVC?

 

System.Web.Routing allows for ASP.NET MVC and FubuMVC.

 

Core design differences with ASP.NET MVC:

 

Framework must support SOLID.  Easy to replace parts without throwing away whole framework

 

Truer implementation of the Front Controller Pattern. (Makes the pipeline much more hackable.

 

Make composition a first-class citizen of the MVC framwork.

 

Mocking the contents of ASP.NET MVC is very difficult

 

InfoQ interview with Chad Myers: http://www.infoq.com/news/2009/04/fubu-mvc/

 

Convention vs. Configuration

 

Start with convention for controller location, etc. and then only use configuration to override conventions.  Actually created Convention classes with lambda expressions to allow you to override the convention.

 

(This is where Weston's video died due to battery charging issues.  Alper Sunar also has video.  Will try to get a link when it is available.)

 

Behaviors

 

Fowler calls them commands in the Front Controller.

 

FubuMVC calls them behaviors using the Chain of Responsibility pattern.  Originally, they were called decorators, but Steve Harman said decorators were too specific.  He suggested the term behaviors.

 

Chad showed the Unit of Work pattern as an example of Behaviors

 

HttpHandlers allow before and after actions, but not full control.  Behaviors give that control.

 

Cultural Differences

 

Safety vs. Sharp Tools

Why can't you abort a request in ASP.NET MVC?

 

Convention scanning vs. Configuration

 

Never manage urls, etc. directly in FubuMVC.  No magic strings.  For example:

 

     return resolver.UrlFor<HomeController>();

 

So, if you rename the HomeController, it just flows through.

 

"Why, now?" - question from Ben Scheirman

None of the following were available before:

 

Why not use MonoRail?

 

Embracing Inversion of Control (IoC)

 

Login Status implemented as a behavior that runs after the Action

 

URL Defaults done through convention, but all can be overwritten with configuration.

 

One Model In One Model Out (OMIOMO) aka Thunderdome Principle

 

Generic Dictionary Converter

 

See Jeremy Miller's MSDN Article for example of Convention over Configuration (need citation).

 

Want to keep Controller Actions very simple to make them easier to test.

 

The implementation of the Configuration code is Chad's least favorite thing in FubuMVC.  Looking for ways to make it easier.