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

Why you should use a MV* framework

Why you should use a MV* framework

Presented at Codee (http://cod.ee.)

More from me about business and technology.

Joël Cox

April 19, 2013
Tweet

More Decks by Joël Cox

Other Decks in Programming

Transcript

  1. - Where are we coming from? - What are the

    challenges? - Where are we heading?
  2. Once upon a time, a team at a small so

    ware company in Redmond, USA set out to make the web a bit more dynamic...
  3. $.post('api/endpoint', {key: value}, { success: function(data) { $('#container').appendTo(data.message); $.get('api/endpoint/' +

    data.id, function(data) { $.get('api/endpoint/2', function(data) { // More callbacks }); }), }, error: function(errorMessage) { $('#container').appendTo(errorMessage); // More callbacks, again. }); } });
  4. <html> <head> <title>Articles</title> <?php if (isset($_COOKIE['auth'])) header('/login'); $article = $db->get_results('SELECT

    * FROM pages WHERE id = "' . mysql_string_escape($_GET['id'] . '"'); ?> </head> <body> <?php foreach ($articles as $article): ?> <h1><?= $article->title ?></h1> <em>By <?= $article->author ?></em> <?= format_body($article->content) ?> <?php endforeach ?> </body> </html>
  5. MVC

  6. - Where are we coming from? - What are the

    challenges? - Where are we heading?
  7. ... Server.prototype.bindListeners = function() { this.socket.on('data', this.processData); }; Server.prototype.doSomething =

    function(part) { ... }; Server.prototype.processData = function(data) { this.doSomething(data); }; > TypeError: Object #<Object> has no method 'doSomething'
  8. ... Server.prototype.bindListeners = function() { this.socket.on('data', this.processData); }; Server.prototype.doSomething =

    function(part) { ... }; Server.prototype.processData = function(data) { this.doSomething(data); }; > TypeError: Object #<Object> has no method 'doSomething' this refers to socket, not Server
  9. ... Server.prototype.bindListeners = function() { this.socket.on('data', this.processData.bind(this)); }; Server.prototype.doSomething =

    function(part) { ... }; Server.prototype.processData = function(data) { this.doSomething(data); }; > TypeError: Object #<Object> has no method 'doSomething'
  10. “Learning JavaScript with Object Graphs” on How To Node “Understanding

    bind and bindAll [in Backbone.js]” on Big Binary
  11. Nested views; how do the different frameworks handle this ?

    (Hints: Zombie views and rerender all the things!)
  12. - Where are we coming from? - What are the

    challenges? - Where are we heading?