Skip to content

Latest commit

 

History

History
100 lines (77 loc) · 7.62 KB

README.md

File metadata and controls

100 lines (77 loc) · 7.62 KB

Faux

Faux is a Javascript library for building Single Page Interface (or "SPI") applications with Backbone.js's Model, View, and Controller classes.

what's a single page application?

Single Page Interface applications are much more responsive than traditional server-side client applications. Traditional applications fetch a complete page from the server as part of every interaction. The HTTP model and the architecture of browsers imposes a large overhead on every page displayed. SPI applications load one page and thereafter all changes to the page are handled in the browser using Javascript to manipulate the DOM. Interactions with the server are handled in the background using AJAX. The result is a much faster user experience that features a finer-grained, richer model of interaction.

what is backbone?

Backbone supplies structure to JavaScript-heavy applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing application over a RESTful JSON interface.--http://documentcloud.github.com/backbone/

what is faux?

Faux is a library that provides structure for a backbone application. Backbone provides terrific support for building Model-View-Controller and Proxy-View-Controller applications in Javascript, but Backbone is deliberately agnostic about how to organize your application at an architectural level and how your application should work at a more detailed level.

Faux provides the missing architectural structure: Faux gives you a place to put your templates, a place to put your Javascript, a convention for naming your classes and controller methods, and answers many more questions about how to build an application wit Backbone. And in addition to providing structure for your application, Faux takes advantage of the structure to write a lot of your code for you. That's why if you write:

controller
  .method('customers');

Faux can wire up a CustomerCollection of Customer models, connect the collection to a CustomerCollectionView, render it through the customer.haml template, and connect it to the #/customers route. Faux gives you a place to start coding if you're new to Backbone, and a standard set of conventions if you're experienced.

Misadventure

Interested in getting a feel for how Faux works? Have a look at our first example application, Misadvanture:

Misadventure is a little game in the style of Adventure. Misadventure is written in Javascript and runs entirely in the browser. Misadventure is written in standard Model-View-Controller style, making heavy use of the Faux and Backbone.js libraries. Here's a four-part code review:

  1. Misadventure, Part I: Overview
  2. Misadventure, Part II: controller.wake()
  3. Misadventure, Part III: Models and Views
  4. Misadventure, Part IV: Class Loading

Challenge Accepted

Lift is a framework that bills itself as "The most powerful, most secure web framework available today." It boasts of Seven Things that distinguish Lift from other web frameworks.

Two of those things are Lazy Loading and Parallel Page Rendering. Here's an example application that demonstrates how Faux provides both of those features. Another of those features is Wiring that manages dependencies between models and views. And here's another example application that shows how Faux uses Backbone.js to do the exact same thing.

note

Faux was conceived on August 19, 2010 as "Roweis." A remark by Jeremy Ashkenas that we were creating a "Faux Server API" led to its new name.

Faux and its documentation is still a work in progress: Future additions to this documentation may or may not include discussions about handling error codes, directly invoking methods, unobtrusive handlers, and some of the other macros such as title, infers, redirects_to, and location.

Faux was created with the support of the International Development Research Centre, a Canadian Crown Corporation created by the Parliament of Canada that supports research in developing countries to promote growth and development. Faux powers software used by the Think Tank Initiative, a multi-donor program dedicated to strengthening independent policy research institutions—or “think tanks” —in developing countries.