$30 off During Our Annual Pro Sale. View Details »

Hierarchical MVC: What, Why & How

vlucas
March 02, 2012

Hierarchical MVC: What, Why & How

vlucas

March 02, 2012
Tweet

More Decks by vlucas

Other Decks in Technology

Transcript

  1. Who am I? • Vance Lucas • http://vancelucas.com • @vlucas

    • Business: http://brightb.it • Oklahoma City • Web developer since 1999 (PHP3) • PHP, JavaScript, Ruby / Web & Mobile Friday, March 2, 2012
  2. Multiple MVC triads working together to compose a single HTTP

    Response for a single HTTP Request Friday, March 2, 2012
  3. Properties of HMVC • Many MVC triads working together •

    Separation of responsibilities of display • Modularization of content & display types Friday, March 2, 2012
  4. A more useful term might be Nested MVC when no

    hierarchy is tracked or enforced Friday, March 2, 2012
  5. HMVC design promotes broader code re-use and separation of responsibilities

    though natural organization and dispatching of MVC triads Friday, March 2, 2012
  6. Instead of using partials and shared template fragments, just pass

    the responsibility to another MVC triad Friday, March 2, 2012
  7. Benefits of HMVC • Shift the responsibility of the display

    and logic down to a self-contained MVC structure • Eliminate repetitive code in controllers passing data to templates and templates passing data to and rendering partials • Call directly in view where needed for display • Built-in widget-like structures • Keep extra business logic contained inside module that deals with it Friday, March 2, 2012
  8. Anywhere you would use a widget or related but separate

    content type on a page Friday, March 2, 2012
  9. Any Shared Content Type • Comments • Tags / Tag

    Clouds • Ratings • Shopping Cart Contents • Menus • RSS/Blog Feeds • Calendars • (etc...) Friday, March 2, 2012