Upgrade to Pro — share decks privately, control downloads, hide ads and more …

MVC - an (re)-introduction

MVC - an (re)-introduction

Oursky Limited

January 13, 2012
Tweet

More Decks by Oursky Limited

Other Decks in Programming

Transcript

  1. MVC • PHP, Pylons, Rails... everywhere. • Almost everyone of

    us learn about MVC the 1st day you join Oursky... • Still remember “separation of concern”? Friday, 13 January, 12
  2. SmallTalk @ 80s • Observer Pattern is used to monitor

    changes in model to update view • Controller is not a mediator between model and view any more as in Web most of the time Friday, 13 January, 12
  3. Era of Web • View cannot observe Model (at least

    until Comet or Ajax became common) • Model 1 / Model II from Java • Rails say: “That’s the new MVC” Friday, 13 January, 12
  4. Era of Web • Controller is more like a meditator

    of Model and View, it collects what the web request needs and pass to View Friday, 13 January, 12
  5. What is the problem of Web MVC? • Model is

    not testable (Newable, Injectable) • Solution @ PandaDesk / PandaForm: • Instead of an class say “UserAccount”, which do both application logic and persistent operation ( .save, .find ....) • We have: • “UserAccount” / “UserAccountTable” for persistent operation, and • “UserAccountService” for application logic Friday, 13 January, 12
  6. Javascript MVC • Similar with traditional MVC, e.g. • Backbone.js

    at FileSquare, or • YUI at PandaForm.com Friday, 13 January, 12