On Tue, Oct 16, 2012 at 4:06 PM, Yehuda Katz <[email protected]> wrote: > On Tue, Oct 16, 2012 at 6:26 PM, Mark S. Miller <[email protected]> wrote: >> Getting the comments with a getter seems fine. Appending only the list of >> comments with a setter is bad, as it does not resemble storage semantics. > > Do you mean appending only to to list of comments? > > `comment.post = post` has similar semantics to setting a foreign key in a > SQL database, which will (obviously) update future requests for "all > comments with post_id=post.id". Bidirectionally linked one-to-many > relationships are pretty common, and it's desirable for the relationships to > remain in sync automatically. I don't think this is the right heuristic for > moving to a method.
Yup; as I argued, the setter only has "non-local" effects if you're using denormalized data (which you almost certainly will be, because it makes the more-common reads more efficient). It's definitely possible to implement identical behavior by having the setter only have a local effect, and having the getter be an expensive traversal. ~TJ _______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

