On Tuesday, September 20, I gave a talk at the New Hampshire Ruby Users Group on Backbone.js on Rails. I’ll be giving a very similar talk on Tuesday, October 11 at boston.rb and a version more targeted to front-end developers on Wednesday, October 26 at the Boston Front End Developers meetup
I have posted the Backbone.js on Rails slides online, and the slide source is on my GitHub.
As an aside, I’m using landslide for the slides – I love the resulting HTML and interface, though I’ve heard great things about deck.js.
People found the resources sections useful. Many of the links are buried in the presenter notes, so I’ll repeat them here. There are plenty more online, and I’m sure I’m missing some content. Please link to any of your favorites in the comments, and I’ll add them.
Testing
- Isolation test with Jasmine:
- Spy/stub/mock, even your HTTP, with sinon.js
- If you’re looking for factory_girl.js, it’s called Rosie
- guard-jasmine autotest your Jasmine with headless webkit (phantomjs)
- Write in CoffeeScript and use the 3.1 asset pipeline with jasminerice
- Get started with James Newbery’s excellent blog posts on testing Backbone with Jasmine
- Check out his examples on GitHub
- Integration test with:
- capybara-webkit for fast, headless, accurate WebKit testing
- Selenium for other browsers, or if capybara-webkit has issues.
Push synchronization
- Rails
Model#save
cascades to clients: backbone_sync-rails over pubsub bus Faye - Work-in-progress Software transactional memory sync: https://github.com/codeparty/racer
- Future plans: diff-match-patch, Operational transform
- Now.js
- Substack DNode
- Data.js: Data Manipulation and Graph Persistence for Node.js and the Browser. Can ride now.js transport.
- substance.io, above, is written with Backbone.js, and is open source https://github.com/michael/substance
- Backbone on the server with node.js… with DNode or NowJS (?!)
Get started with Backbone
Further reading: Books on JavaScript
- JavaScript: The Good Parts by Douglas Crockford
- JavaScript Web Applications by Alex MacCaw (Spine.js author)
- Test-Driven JavaScript Development by Christian Johansen
- JavaScript Patterns by Stoyan Stefanov
- JavaScript: The Definitive Guide by David Flanagan