backbone.js – an introduction

36
Javascript Developer at The New York Times Company developing Ricochet Bobby Roe

Upload: bobbyroe

Post on 01-Jul-2015

682 views

Category:

Technology


0 download

DESCRIPTION

Backbone.js – an introduction

TRANSCRIPT

Page 1: Backbone.js – an introduction

Javascript Developer at The New York Times Companydeveloping Ricochet

Bobby Roe

Page 2: Backbone.js – an introduction

Backbone.jsAn Introduction

Page 3: Backbone.js – an introduction

What is it?

Backbone.js is the model & view layerfor your javascript app

Page 4: Backbone.js – an introduction

Why?

* The DOM isn't the source of truth in your app.

Page 5: Backbone.js – an introduction

jQuery is good.

Storing state in the DOM is bad.

Page 6: Backbone.js – an introduction

* A single source of data for the UI to render.

Page 7: Backbone.js – an introduction

not just a web siteto create a web app

Page 8: Backbone.js – an introduction

Here are a whole bunch of real world projects

Page 9: Backbone.js – an introduction

Core Features

Page 10: Backbone.js – an introduction

Models - attributes

Page 11: Backbone.js – an introduction

Collections - filter, transform, manage your models

Page 12: Backbone.js – an introduction

Views - UI events - data events (on) * acts as controllers

Page 13: Backbone.js – an introduction

Other Features... not covered here --

* Routers * the Sync function

Page 14: Backbone.js – an introduction

Demo -- Mastermind

Page 15: Backbone.js – an introduction

?

Page 16: Backbone.js – an introduction

?

Page 17: Backbone.js – an introduction
Page 18: Backbone.js – an introduction
Page 20: Backbone.js – an introduction
Page 24: Backbone.js – an introduction

View methods

Page 25: Backbone.js – an introduction

initialize

Page 26: Backbone.js – an introduction

render

Page 27: Backbone.js – an introduction

template

Page 28: Backbone.js – an introduction

Chrome console demo

Page 30: Backbone.js – an introduction

Game_view: initialize

Page 31: Backbone.js – an introduction

Game_view: render

Page 32: Backbone.js – an introduction

A Couple of Potholes to Avoid

Page 33: Backbone.js – an introduction

Do: Fully re-render your views (from templates).

Don't: show / hide bits of UI / get & set HTML attributes.

Page 34: Backbone.js – an introduction

Do: Look at a lot of examples & keep your functions simple & small.

Don't write intimidating, epic code.

Page 35: Backbone.js – an introduction

Summary

Backbone is the model & view layer for your app * one source of data * optimized rendering * simple core features that rock

Page 36: Backbone.js – an introduction

Thank youhttp://bobbyroe.com/mm