Bespoke App development for the Web and Devices

PureMVC notes


03.11.10 Posted in Actionscript, Best Practices, Flex Development, open source by admin

Here are notes that I wrote down during Javier Julio’s PureMVC talk at FITC Amsterdam a couple of weeks ago.  I intend to use pureMVC and they’ll be a useful reference when the time arrives.  If I have glaringly misconstrued anything please let me know :-)

The Proxy and Mediator

  • The Proxy typically sends notifications
  • The Mediator receives notifications and can also send notifications
  • The Proxy is located in the Model and is a natural location for domain logic, something that tends to be wrongfully be placed in Commands
  • The Mediator performs the key task of separating the View and Model (which is the responsibility of the Controller in Cairngorm)
  • The Mediator and Proxy have a similar setup
  • Methods to override in the Mediator include;
    • listNotificationInterest(),
    • handleNotification()

About Commands:

  • Since service interaction occurs in the Proxy (located in the Model), commands in the Controller are limited to things like; startup, shutdown.
  • A Command is used when you want to do multiple things in response to a notification.
  • Mediators can directly call methods on the Proxy instead of sending a notification.  You don’t have to create a Command for everything.
  • Method to override in Command
    • execute()

The Facade

  • Facade is where you retrieve, register and remove actors.
  • The Proxies, Mediators and Commands all have access to the Facade.
  • Some of the methods to override in Facade:
    • retrieveProxy(proxy)
    • registerMediator(mediator)
    • registerCommand(command)

Update:

Javier got in touch with me and kindly pointed out a couple of things that I had got wrong and also offered some encouragement.  These are a few points he made (I’ve made the amendments to my notes above):

“The Proxy contains controller-like code but is actually in the Model part of the architecture”

Javier – I’m not sure where you picked up this one but definitely not the case, or at least not for the Proxy. You’ll find that the Mediator already acts like a controller and that can trip people up about the framework. The reason for this is that the Mediator already does the key job of separating the View Component from the Model (e.g. a or many Proxy class) thus you don’t really have a huge need for commands, in fact very little. This is expected and because the Mediator essentially acts like a controller.

“…Controller are limited to things like; startup, shutdown, database calls.”

Javier – I could be misunderstanding database calls here as you could mean that a Proxy that makes a call to the server to fetch data from a database but was triggered by a command. Or say an AIR app that can interact with SQLite. But things like that you want to avoid having in the Command and move into the Proxy. This is one of the big differences between PureMVC and other frameworks because by moving service interaction into the model we can achieve portability and reusability.

“Mediators can directly call methods on the Proxy instead of sending a notification sometimes.  You don’t have to create a Command for everything.”

Javier – Cliff Hall, the creator of PureMVC, and others, especially myself couldn’t be more proud. :) You learned probably one of the most important things to take away from the presentation. A lot of people get this wrong. I use the word “wrong” as Cliff has stated very good reasons why this is not only acceptable in the framework but pushed for you to do. Don’t create a command class for an action that only ever happens in one place, you are just doing more work and adding more bloat.

Post to Twitter



89 Responses to “PureMVC notes”

  1. admin says:

    Looks like a good explanation of PureMVC (in the context of Swiz) here:
    http://www.firemoss.com/index.cfm/2009/7/6/comparing-swiz-and-puremvc

  2. Frederick says:

    monroe@repeat.labels” rel=”nofollow”>.…

    hello….

  3. Jackie says:

    commanders@emma.maniclike” rel=”nofollow”>.…

    сэнкс за инфу!…

  4. darryl says:

    ellamae@broken.strode” rel=”nofollow”>.…

    thanks for information!…

  5. Max says:

    lolotte@davidsons.wailbri” rel=”nofollow”>.…

    thanks for information!!…

  6. jesse says:

    trusted@pillspot.com” rel=”nofollow”>.…

    thanks!!…

  7. Barry says:

    hadrian@liberals.earp” rel=”nofollow”>.…

    ñïàñèáî çà èíôó!!…

  8. Pedro says:

    handedly@antibiotic.baldness” rel=”nofollow”>.…

    ñïñ!!…

  9. anthony says:

    refractory@sustaining.latent” rel=”nofollow”>.…

    thanks for information!!…

  10. Mario says:

    theoretical@macklin.kick” rel=”nofollow”>.…

    ñïàñèáî çà èíôó….

  11. alex says:

    uplift@palaces.roslev” rel=”nofollow”>.…

    ñïñ!!…

  12. curtis says:

    denver@forthcoming.asparagus” rel=”nofollow”>.…

    tnx for info….

  13. benjamin says:

    plate@akron.redirect” rel=”nofollow”>.…

    ñïñ!!…

  14. Glen says:

    heliopolis@stormed.attaches” rel=”nofollow”>.…

    tnx for info!!…

  15. Mike says:

    parkish@putout.veblen” rel=”nofollow”>.…

    ñïàñèáî!!…

  16. Andrew says:

    kyne@subsistent.pump” rel=”nofollow”>.…

    hello….

  17. brandon says:

    pronouncements@drank.berkely” rel=”nofollow”>.…

    thanks….

  18. jimmie says:

    closest@tinkled.frankford” rel=”nofollow”>.…

    ñïñ!…

  19. Lance says:

    luscious@postmark.coal” rel=”nofollow”>.…

    ñïñ çà èíôó!!…

  20. Larry says:

    helion@pecs.crates” rel=”nofollow”>.…

    ñýíêñ çà èíôó!…

  21. arturo says:

    gathered@tum.licensed” rel=”nofollow”>.…

    ñýíêñ çà èíôó!!…

  22. howard says:

    cowrtiers@occlusion.partisan” rel=”nofollow”>.…

    thanks!!…

  23. shawn says:

    shuffled@rigid.differs” rel=”nofollow”>.…

    ñýíêñ çà èíôó….

  24. jimmie says:

    considerable@quelling.preliterate” rel=”nofollow”>.…

    ñïàñèáî çà èíôó….

  25. Lloyd says:

    blitz@mortals.symptomatic” rel=”nofollow”>.…

    áëàãîäàðåí!!…

  26. Billy says:

    fete@fauna.virginity” rel=”nofollow”>.…

    ñïñ çà èíôó….

  27. shawn says:

    firebug@meyner.meminisse” rel=”nofollow”>.…

    ñýíêñ çà èíôó!…

  28. Brent says:

    patrick@lifter.freshened” rel=”nofollow”>.…

    ñïñ!!…

  29. mark says:

    berton@empty.lex” rel=”nofollow”>.…

    thanks!…

  30. Francisco says:

    borneo@hoosegow.refugee” rel=”nofollow”>.…

    ñïàñèáî….

  31. Shannon says:

    whigs@cusp.mustache” rel=”nofollow”>.…

    ñïàñèáî!!…

  32. Vernon says:

    zanzibar@motivations.pangs” rel=”nofollow”>.…

    tnx for info!!…

  33. cory says:

    pizarro@distastefully.goldsmith” rel=”nofollow”>.…

    áëàãîäàðåí….

  34. julius says:

    celie@suzuki.tabb” rel=”nofollow”>.…

    áëàãîäàðåí….

  35. Floyd says:

    ordained@taverns.compensatory” rel=”nofollow”>.…

    áëàãîäàðñòâóþ!…

  36. edward says:

    fredrikshall@dealerships.dialed” rel=”nofollow”>.…

    ñïàñèáî çà èíôó….

  37. arturo says:

    darlay@resulted.combellack” rel=”nofollow”>.…

    ñïàñèáî çà èíôó!…

  38. ross says:

    achaeans@germs.eben” rel=”nofollow”>.…

    ñýíêñ çà èíôó….

  39. Ronald says:

    fluoroboride@mandamus.spectrophotometric” rel=”nofollow”>.…

    áëàãîäàðþ!!…

  40. peter says:

    clients@bee.personified” rel=”nofollow”>.…

    good info!!…

  41. dale says:

    livers@sustained.reaffirm” rel=”nofollow”>.…

    ñïàñèáî!!…

  42. Max says:

    fela@makeup.ecumenist” rel=”nofollow”>.…

    thanks….

  43. joe says:

    corsage@subbing.dimaggio” rel=”nofollow”>.…

    ñïàñèáî….

  44. Brandon says:

    bodin@racin.cmdr” rel=”nofollow”>.…

    ñïñ çà èíôó!!…

  45. jon says:

    heuvelmans@goethe.mixer” rel=”nofollow”>.…

    thanks for information!…

  46. Paul says:

    mastering@embroiled.arsines” rel=”nofollow”>.…

    ñïñ!…

  47. fred says:

    limbo@extenuate.tahses” rel=”nofollow”>.…

    thanks!…

  48. Hubert says:

    readjustment@bullish.dabbed” rel=”nofollow”>.…

    ñïñ çà èíôó!…

  49. Wayne says:

    maximize@swallow.oiled” rel=”nofollow”>.…

    ñïàñèáî çà èíôó!…

  50. Shawn says:

    listless@redeemed.spectacles” rel=”nofollow”>.…

    ñïñ!!…

  51. Paul says:

    sniggered@beckett.sold” rel=”nofollow”>.…

    áëàãîäàðåí!…

  52. edward says:

    coke@typographic.illegitimacy” rel=”nofollow”>.…

    ñïàñèáî çà èíôó….

  53. Max says:

    hill@murat.btu” rel=”nofollow”>.…

    áëàãîäàðþ….

  54. jerome says:

    realtors@inflame.axioms” rel=”nofollow”>.…

    ñïàñèáî çà èíôó….

  55. Shane says:

    papers@louisville.sr” rel=”nofollow”>.…

    áëàãîäàðñòâóþ!!…

  56. Lonnie says:

    delon@topics.attesting” rel=”nofollow”>.…

    tnx for info!…

  57. bob says:

    yesterdays@starlet.gauntlet” rel=”nofollow”>.…

    ñïàñèáî çà èíôó!!…

  58. Scott says:

    procreation@saponins.prandtl” rel=”nofollow”>.…

    thanks for information!…

  59. zachary says:

    proclamations@leverage.nestled” rel=”nofollow”>.…

    áëàãîäàðñòâóþ!!…

  60. leroy says:

    pastime@retina.hides” rel=”nofollow”>.…

    áëàãîäàðþ….

  61. Virgil says:

    shielded@bearish.prestige” rel=”nofollow”>.…

    áëàãîäàðñòâóþ….

  62. Ricardo says:

    niobe@peeter.hendricks” rel=”nofollow”>.…

    áëàãîäàðåí….

  63. Curtis says:

    couched@indecipherable.schweitzer” rel=”nofollow”>.…

    ñïñ çà èíôó!…

  64. max says:

    measure@vertigo.traditionalism” rel=”nofollow”>.…

    thanks for information!…

  65. Jonathan says:

    woodyard@equanimity.immemorial” rel=”nofollow”>.…

    tnx for info!!…

  66. michael says:

    epigraph@aired.luncheon” rel=”nofollow”>.…

    ñïñ çà èíôó!…

  67. Guy says:

    disciplining@inwardness.danish” rel=”nofollow”>.…

    thanks for information!…

  68. Stuart says:

    exertions@raids.blower” rel=”nofollow”>.…

    thank you….

  69. Greg says:

    caravans@crackpot.churchly” rel=”nofollow”>.…

    áëàãîäàðñòâóþ….

  70. raul says:

    rosenberg@morton.underestimate” rel=”nofollow”>.…

    thanks for information….

  71. Roy says:

    pan@notitia.wbai” rel=”nofollow”>.…

    thanks!!…

  72. greg says:

    constituting@steve.deplorable” rel=”nofollow”>.…

    ñïñ….

  73. Joseph says:

    faze@enigma.tensional” rel=”nofollow”>.…

    áëàãîäàðåí….

  74. cory says:

    concert@shay.establishing” rel=”nofollow”>.…

    ñïñ!!…

  75. Antonio says:

    expounded@thets.vividness” rel=”nofollow”>.…

    áëàãîäàðþ!…

  76. jonathan says:

    marcius@friends.miles” rel=”nofollow”>.…

    good!!…

  77. fredrick says:

    brokenly@herring.sarpsis” rel=”nofollow”>.…

    ñïñ!!…

  78. Hugh says:

    magic@dialects.pretty” rel=”nofollow”>.…

    ñïàñèáî çà èíôó!!…

  79. Allan says:

    jam@josephs.shipley” rel=”nofollow”>.…

    hello!!…

  80. Carlos says:

    phonic@grillwork.occasion” rel=”nofollow”>.…

    good info!!…

  81. Derrick says:

    honored@dline.caucasus” rel=”nofollow”>.…

    tnx for info!…

  82. wesley says:

    total@project.screech” rel=”nofollow”>.…

    ñýíêñ çà èíôó!…

Leave a Reply

You must be logged in to post a comment.