I studied both of these libraries when I was looking for something like EmberData or Restangular for Backbone.
Both of these libraries try to compensate for the underlying weakness of magic: handle the Rest API Restful Resources correctly.
In fact, Backbone facilitates the creation of new models every time they need to be visualized (instead of reusing the instance used for another rendering elsewhere in the application).
Some inconsistencies occur when some model updates are not distributed throughout the web application.
Then, a cache of the trunk model instances is required. Backbone Relational provides such a cache, but the Backbone Association does not.
In addition, both of them redefined the Backbone code methods (set, get, reset, trigger), so they are closely related to Backbone.
This can complicate the migration of the Backbone library, especially if you use a different MVC structure on top of the Backbone (Marionnette, Thorax, Chaplin, ...)
Backbone association is easier than Backbone Relational in terms of lines of code (800 vs. 2000).
- The implementation of the Backbone Association is easier to debug because it directly manages relationships in overloaded methods (set, get, ...)
- In contrast, Backbone Relational relies on queues to synchronize relationship content with its internal repository. This makes debugging difficult ...
Another easy (but less used) alternative is "Backbone SuperModel": http://pathable.imtqy.com/supermodel/
- This library combines 800 lines of code that are easier to understand than Backbone Relational (I myself was able to fix a small error).
- It offers a basic cache instance based on the Backbone Collection.
On my side,
- I managed to integrate the latter with RequireJs
- I manage some polymorphic associations with him
- A protocol has appeared between my web application and my Java base.
- I need to update Backbone and Marionette every time I need
source share