

Backbone.js: Hacker's Guide Part 2 (Backbone.Collection) - raja
http://dailyjs.com/2012/07/26/mvstar-3

======
brlewis
For relational data, would a Model represent a row and a Collection represent
a result set? I usually think of an MVC app as having a single model
representing a schema. It sounds like Backbone is different.

~~~
jashkenas
Yep -- the key bit here is that on the server you have access to the entire
table of rows, so it makes some sense to conflate the, say, Book class with
the entire set of all possible books.

On the client side, you very rarely have access to the entire table -- often
you have different slices of it based on different search queries, or
associations -- every Book has its own collection of Notes, for example. So
just mimicking the Rails-style 1:1 mapping can be a bit of a fallacy.

------
sroussey
Also, for those debugging, see:

[https://twitter.com/illuminations4d/status/22728017176024268...](https://twitter.com/illuminations4d/status/227280171760242688/photo/1/large)

------
MatthewPhillips
Can the JavaScript elite please get together and make a decision on
Backbone.Events vs. EventEmitter vs. EventTarget?

Also, I recommend everyone read TJ Holowaychuck's latest blog post[1] and lets
start distributing these types of things as components instead of
"frameworks".

[1]<http://tjholowaychuk.com/post/27984551477/components>

~~~
lobo_tuerto
What is the decision to be made? could you explain a little?

~~~
MatthewPhillips
These are 3 implementations of the same thing. I can imagine there are people
using Backbone, YUI, and EventEmitter. Oh, and they might be using some other
library which shims the EventTarget interface and uses CustomEvent objects.

Read the Holowaychuk article. We need to stop working with frameworks and
start working with components. How great would it be of I could use Backbone
without Events (not picking on Backbone.Events here, just an example), or use
a JQuery function that one of my libraries requires without including all 32k
of it.

------
blktiger
That void 0 trick was new to me.

