| 
  • If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • Work with all your cloud files (Drive, Dropbox, and Slack and Gmail attachments) and documents (Google Docs, Sheets, and Notion) in one place. Try Dokkio (from the makers of PBworks) for free. Now available on the web, Mac, Windows, and as a Chrome extension!

View
 

Fubu MVC  (redirected from Fubu-MVC)

Page history last edited by Peter Seale 12 years, 6 months ago

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?

  • Started with ASP.NET MVC Preview 2
  • After extending it, realized not using much of ASP.NET MVC
  • Mainly, they were using MVC Routing

 

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

  • Came out of ASP.NET MVC project
  • Now part of .NET Framework 3.5 SP1 base class library (BCL)

 

Core design differences with ASP.NET MVC:

  • Composition vs. Inheritance
  • ASP.NET MVC is very inheritance oriented
  • FubuMVC is very much based on interfaces
  • Heavy use of Inversion of Control.  Does not require IoC container, but it helps
  • Uses SOLID principles especially the Interface Segregation Principle

 

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

  • All done at the same time in FubuMVC
  • In ASP.NET MVC, there are several places to do 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:

  •      Routing
  •      C# Lambdas
  •      Better Ioc container behavior

 

Why not use MonoRail?

  • Not as much functional composition

 

Embracing Inversion of Control (IoC)

  • Pervasive throughout FubuMVC
  • Everything is injected via IoC (Views, Controllers, ActionInvokers, etc.)

 

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

  • Controller action in ASP.NET MVC has two responsibilities: Action and Return Result
  • FubuMVC breaks up these into two different responsibilities.
  • Can use a different approach.  Does not require OMIOMO.

 

Generic Dictionary Converter

  • Pulls from request to build the InputModel automatically using static reflection (may not be in the published code, yet).

 

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.

Comments (0)

You don't have permission to comment on this page.