paulkoegel / colognejs-talk-2012-11

"Solitaire mit Backbone"

Home Page:http://paulkoegel.github.io/colognejs-talk-2012-11/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Solitaire in Backbone - CologneJS, 13.11.2012 - Paul Kögel

Slides

http://paulkoegel.github.io/colognejs-talk-2012-11/
source: https://github.com/paulkoegel/colognejs-talk-2012-11

Links from the Slides

Backbone Pros & Cons

The Gist of it all

  1. Javascript MVC
  • provides structure for your Javascript code - less jQuery spaghetti code
  • cf. "Is it MVC, or what?" below
  1. View Synching
  • update your views whenever your models' attributes change
  1. Data Synching (not at all implemented in Irmingard)
  • offers painless synching of Backbone models to and from your server via Ajax and JSON

Pros

  • active community & widely used
  • mature (initial commit: Sep 30, 2010)
  • good documentation & many great tutorials
  • lightweight (6kB, v0.9.2)
  • templating engine agnostic (HAMLc, underscore templates, handlebars, eco, jade etc.)
  • highly customizable (unlike many other JS MVC solutions)

Cons

  • rather barebone, lacking esp. View functionality and conventions for larger JS apps (that's why there are so many libraries built on top of it, Backbone core is intentionally being kept minimal)
  • comparatively verbose to set up View behaviour
  • lacks automatic Model-View bindings

Backbone Extensions

  • Backbone Marionette Composite application architecture. Better view handling and unbinding. Alternative to 9elements' Chaplin but more mature.

  • Backbone Relational Hierarchies of Backbone Models - 'has many'-relations etc.

  • Backbone Model Binder Provides Model-View bindings. Interesting to autosync from a view to a model via input fields etc. (plain Backbone only makes the other way around really easy).

  • HAML Coffee Assets Backbone templates with HAML syntax. After '-' and '=' you'll be writing CoffeeScript instead of Ruby.

Resources

Is it MVC, or what?

In some regards, Backbone comes a lot closer to the original MVC architecture than, e.g., Rails. MVC was designed by Trygve Reenskaug in 1979 while working on Smalltalk-80:

  • called it "Model-View-Controller-Editor"
  • View-Controller pair required for each element on the screen; no true separation
  • Controller’s role: handling user input
  • observer pattern: Views and Controllers subscribe to Models
  • the View is automatically updated whenever the Model changes (for all of this cf. Addy Osmani's Developing Backbone.js Applications above)

Nevertheless, Backbone's usually considered MV* - it doesn't really follow the MVC pattern but has some important MVP features as well. Cf. Backbone.js Is Not An MVC Framework.

Kudos

Errata

Contrary to what I said in the talk, it's usually my sister who solves my really tough save games - not the other way around :)

About

"Solitaire mit Backbone"

http://paulkoegel.github.io/colognejs-talk-2012-11/

License:MIT License


Languages

Language:JavaScript 45.2%Language:CSS 42.9%Language:HTML 10.2%Language:GLSL 1.5%Language:Ruby 0.2%