Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

RT-MVC: Real Time Model/View/Controller Applications


Published on

Video and slides synchronized, mp3 and slide download available at

Daniel Erickson addresses the problems appearing in mixing MVC and real time frameworks in web applications and how Geddy transparently solves these issues. Filmed at

Daniel Erickson has spent the better part of the last 8 years evolving with the web. He currently works for Yammer as a Senior JavaScript Engineer. He is a core contributor for Geddy, one of the leading web frameworks for Node.js. He has been working with Node since it's early days back in 2010, and has worked with a number of companies to help them write well organized Node applications.

Published in: Technology, Business
  • Be the first to comment

RT-MVC: Real Time Model/View/Controller Applications

  1. 1. 11/7/12 Real Time and MVC with GeddyJS1/30file://localhost/Users/derickson/dev/presentations/2012/qconsf/index.html?print‑pdf#/1RT-MVCReal Time Model/View/Controller Applications/Daniel Erickson qConSF
  2. 2. News & Community Site• 750,000 unique visitors/month• Published in 4 languages (English, Chinese, Japanese and BrazilianPortuguese)• Post content from our QCon conferences• News 15-20 / week• Articles 3-4 / week• Presentations (videos) 12-15 / week• Interviews 2-3 / week• Books 1 / monthWatch the video with slidesynchronization on!
  3. 3. Presented at QCon San Franciscowww.qconsf.comPurpose of QCon- to empower software development by facilitating the spread ofknowledge and innovationStrategy- practitioner-driven conference designed for YOU: influencers ofchange and innovation in your teams- speakers and topics driving the evolution and innovation- connecting and catalyzing the influencers and innovatorsHighlights- attended by more than 12,000 delegates since 2007- held in 9 cities worldwide
  4. 4. 11/7/12 Real Time and MVC with GeddyJS2/30file://localhost/Users/derickson/dev/presentations/2012/qconsf/index.html?print‑pdf#/1WHATS GOING TOWINREAL TIME OR MVC?
  5. 5. 11/7/12 Real Time and MVC with GeddyJS3/30file://localhost/Users/derickson/dev/presentations/2012/qconsf/index.html?print‑pdf#/1REAL TIME?
  6. 6. 11/7/12 Real Time and MVC with GeddyJS4/30file://localhost/Users/derickson/dev/presentations/2012/qconsf/index.html?print‑pdf#/1YEAH!CUZ SOME PEOPLE SAY:MVC doesnt scale wellMVC is dead
  7. 7. 11/7/12 Real Time and MVC with GeddyJS5/30file://localhost/Users/derickson/dev/presentations/2012/qconsf/index.html?print‑pdf#/1BUT MVC IS HERE TO STAYGives teams structure to get things doneAllows new people to jump into your projectEasy to get started with
  8. 8. 11/7/12 Real Time and MVC with GeddyJS6/30file://localhost/Users/derickson/dev/presentations/2012/qconsf/index.html?print‑pdf#/1WHATS GOING TOWINREAL TIME OR MVC?
  9. 9. 11/7/12 Real Time and MVC with GeddyJS7/30file://localhost/Users/derickson/dev/presentations/2012/qconsf/index.html?print‑pdf#/1MVC?
  10. 10. 11/7/12 Real Time and MVC with GeddyJS8/30file://localhost/Users/derickson/dev/presentations/2012/qconsf/index.html?print‑pdf#/1TOTALLY!CUZ PEOPLE THINK:Real Time is hardMaintain a new stackEvent Machine and Tornado suckFront end code is messy
  11. 11. 11/7/12 Real Time and MVC with GeddyJS9/30file://localhost/Users/derickson/dev/presentations/2012/qconsf/index.html?print‑pdf#/1BUT REAL TIME IS ALSO HERE TO STAYUse WebSockets to get updates on the front endInstant feedback for your usersWorks really well on mobile
  12. 12. 11/7/12 Real Time and MVC with GeddyJS10/30file://localhost/Users/derickson/dev/presentations/2012/qconsf/index.html?print‑pdf#/1WHATS GOING TOWINREAL TIME OR MVC?
  13. 13. 11/7/12 Real Time and MVC with GeddyJS11/30file://localhost/Users/derickson/dev/presentations/2012/qconsf/index.html?print‑pdf#/1BOTH!
  14. 14. 11/7/12 Real Time and MVC with GeddyJS12/30file://localhost/Users/derickson/dev/presentations/2012/qconsf/index.html?print‑pdf#/1REAL TIME AND MVCACTUALLY MIX PRETTY WELL
  15. 15. 11/7/12 Real Time and MVC with GeddyJS13/30file://localhost/Users/derickson/dev/presentations/2012/qconsf/index.html?print‑pdf#/1YOU CAN:Define your model once and use it all over the placeuse your templates on both sides of HTTPMirror events from the backend to the frontendinstance createdinstace updatedinstance removed
  16. 16. 11/7/12 Real Time and MVC with GeddyJS14/30file://localhost/Users/derickson/dev/presentations/2012/qconsf/index.html?print‑pdf#/1HOW WE SOLVED THEREAL TIME PROBLEMWITH GEDDY
  17. 17. 11/7/12 Real Time and MVC with GeddyJS15/30file://localhost/Users/derickson/dev/presentations/2012/qconsf/index.html?print‑pdf#/1WAIT,WHATS GEDDY?
  18. 18. 11/7/12 Real Time and MVC with GeddyJS16/30file://localhost/Users/derickson/dev/presentations/2012/qconsf/index.html?print‑pdf#/1THE ORIGINAL MVCFRAMEWORK FOR NODE.JSVery familiar if you know RailsAwesome noSQL and SQL ORMMany different templating languages
  19. 19. 11/7/12 Real Time and MVC with GeddyJS17/30file://localhost/Users/derickson/dev/presentations/2012/qconsf/index.html?print‑pdf#/1AND NOW ITSUPPORTS REAL TIMERIGHT OUT OF THE BOX
  20. 20. 11/7/12 Real Time and MVC with GeddyJS18/30file://localhost/Users/derickson/dev/presentations/2012/qconsf/index.html?print‑pdf#/1SO LETS MAKE AN MVC APPTHAT SUPPORTS REAL TIME
  21. 21. 11/7/12 Real Time and MVC with GeddyJS19/30file://localhost/Users/derickson/dev/presentations/2012/qconsf/index.html?print‑pdf#/1GENERATE AN APP$ npm install -g geddy$ geddy app -rt demo$ cd demo$ geddy scaffold -rt thing title description$ geddy
  22. 22. 11/7/12 Real Time and MVC with GeddyJS20/30file://localhost/Users/derickson/dev/presentations/2012/qconsf/index.html?print‑pdf#/1TEST IT OUTOpen upandhttp://localhost:4000/thingshttp://localhost:4000/things/add
  23. 23. 11/7/12 Real Time and MVC with GeddyJS21/30file://localhost/Users/derickson/dev/presentations/2012/qconsf/index.html?print‑pdf#/1FOR THOSE OF YOU FOLLOWINGALONG AT HOME1. add a thing2. watch it show up in the other window3. update the thing4. watch it change in the other window5. remove the item6. watch it get removed from the other window.
  24. 24. 11/7/12 Real Time and MVC with GeddyJS22/30file://localhost/Users/derickson/dev/presentations/2012/qconsf/index.html?print‑pdf#/1WHAT JUST HAPPENED?geddy app -rt demoGenerated a demoapp with realtime enabled
  25. 25. 11/7/12 Real Time and MVC with GeddyJS23/30file://localhost/Users/derickson/dev/presentations/2012/qconsf/index.html?print‑pdf#/1WHAT JUST HAPPENED?geddy scaffold -rt thing ...Generated a thingresourcethingmodelmade that model available on the front endthingscontrollerroutesviews that subscribe to the realtime events
  26. 26. 11/7/12 Real Time and MVC with GeddyJS24/30file://localhost/Users/derickson/dev/presentations/2012/qconsf/index.html?print‑pdf#/1HOW DOES IT WORK?ON THE SERVER SIDE:geddy sees the realtimeflag in your config filecopies your models over to a public js filesets up listeners for each models lifecycle eventsproxies those lifecycle events to
  27. 27. 11/7/12 Real Time and MVC with GeddyJS25/30file://localhost/Users/derickson/dev/presentations/2012/qconsf/index.html?print‑pdf#/1HOW DOES IT WORK?ON THE CLIENT SIDE:registers listeners for all model related eventsproxies them to the appropriate modelsscaffolds some code that hooks into real time events
  28. 28. 11/7/12 Real Time and MVC with GeddyJS26/30file://localhost/Users/derickson/dev/presentations/2012/qconsf/index.html?print‑pdf#/1THATS PRETTY COOL,BUT IS IT EASY TO CHANGE?modify your model once and you get it everywhereemit custom events on your modelsall generated code can be modified
  29. 29. 11/7/12 Real Time and MVC with GeddyJS27/30file://localhost/Users/derickson/dev/presentations/2012/qconsf/index.html?print‑pdf#/1WHATS NEXT ON THE ROADMAP?Create an AJAX adapter for the front-end ORMReal time queriesPer instance real time eventsA better way to share templates
  30. 30. 11/7/12 Real Time and MVC with GeddyJS28/30file://localhost/Users/derickson/dev/presentations/2012/qconsf/index.html?print‑pdf#/1WANT TO HELP OUT?CHECK OUT GEDDY ATJoin the mailinglistopen bugs on githubsend us pull requests
  31. 31. 11/7/12 Real Time and MVC with GeddyJS29/30file://localhost/Users/derickson/dev/presentations/2012/qconsf/index.html?print‑pdf#/1ANY QUESTIONS?
  32. 32. 11/7/12 Real Time and MVC with GeddyJS30/30file://localhost/Users/derickson/dev/presentations/2012/qconsf/index.html?print‑pdf#/1