Friday, 15 January 2010

rest - Backbone.js architecture: collections vs javascript arrays -



rest - Backbone.js architecture: collections vs javascript arrays -

i start develop first application uses backbone. looking lot of tutorials, can't decide how architecture app, since it's different typical single-model crud example. here deal:

my app atlas of ants. basically, user select ant species, optionally add together filters , shown leaflet.js map , spreadsheet-like table of results. we'll need accumulate several search results on page (for illustration compare geographic distribution of different species).

i envisioned 2 options there:

a) either (backbone) model ant occurrence, , each user search different backbone collection, containing matching occurrences , few search-level properties. makes sense, since server-side model ant occurrence, , i'll able take total advantage of automatic rest integration. i'll have utilize javascript array maintain track of these different collections. events have managed on these collections, illustration when user want remove previous search displayed data.

b) either model "search" object, , these various accumulated searches kept in collection. can take total advantage of these collections, client/server models not same thing (searches vs occurrences), won't able utilize simple restful approach there.

what take ?

thanks, nicolas

i find confusing when have figure out whether collection or array, pick 1 , stick it. more functionality out of backbone collections, take , avoid arrays.

javascript rest backbone.js

No comments:

Post a Comment