Backbone and MVC

13 views
Skip to first unread message

John Wiseman

unread,
Dec 27, 2012, 2:28:15 PM12/27/12
to mave...@googlegroups.com
Since mavelous uses Backbone.js quite a lot, you might be interested in this: http://addyosmani.github.com/backbone-fundamentals/

I've also been looking at PlastronJS, which is a Backbone-style MVC framework that is google closure-compatible: https://github.com/rhysbrettbowen/PlastronJS


John

Pat Hickey

unread,
Dec 30, 2012, 10:37:05 PM12/30/12
to mavelous
John,

I don't really know enough about the closure compiler to know what makes PlastronJS compatible and Backbone incompatible, but can you explain the advantage of using a compatible framework?

PlastronJS looks similar enough to Backbone that it might not be too hard to translate over - we aren't married to any Backbone-isms - but I'd like to understand better before undertaking that task.

Pat


--
 
 

John Wiseman

unread,
Dec 31, 2012, 8:26:19 PM12/31/12
to mave...@googlegroups.com
Using something closure-compatible would offer a few advantages.  We should keep them in mind, but at the moment I don't think they're compelling enough to convert working code from Backbone to something else.

The advantages would be, in order of decreasing significance:

1. Smaller and possibly faster code.  Closure-compatible code can all be compiled together by the closure compiler, in ADVANCED_OPTIMIZATIONS mode (hopefully).  This is a very aggressive minimization that will rename almost every symbol in the code.  It also does dead code removal and function inlining.  It's unlikely that code that isn't written with closure in mind will work in ADVANCED_OPTIMIZATIONS mode.

2. Better type-checking.  Currently I have to find or write an "externs" file that declares the functions offered by third party libraries along with their argument types and return types.  It's a lot of work to do that, so I've only declared the methods we use and haven't really fleshed out all of the types.  More detailed type info just means the closure compiler can warn us about potential type mismatches.   (I have regretted almost every type declaration I've ever written in Lisp, but somehow Javascript feels different.)


--
 
 

Reply all
Reply to author
Forward
0 new messages