[rspec-users] Associations should be private

Mark Wilden mark at mwilden.com
Wed Oct 1 10:54:08 EDT 2008

On Wed, Oct 1, 2008 at 6:11 AM, David Chelimsky <dchelimsky at gmail.com>wrote:

> It's been a while since I've taken a look at it, but Luke Redpath has
> a plugin called Demeter's Revenge
> (http://plugins.code.lukeredpath.co.uk/browser/demeters_revenge/trunk)
> that actually manages this all for you by adding methods like
> team.add_player that wrap chains like team.players.add. It's a year
> old and I don't know if it works w/ the latest rails updates or not.

See, this is what I don't get about Demeter. By adding delegators, you might
trick someone into thinking that you're not playing with other objects'
parts, but really you still are. Does Demeter just mean mechanically adding
a level of indirection?

For example, in the case under discussion, even with Demetering, you're
_still_ going to get back a proxy object, and end up with the same problem,
aren't you?


P.S. Of course, controlling access to data (especially changing it) can
often be a Good Thing. But that's just a general principle and applies to
your own data as well as to your data's data's data. Nothing Demetery there.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20081001/7af86c3b/attachment.html>

More information about the rspec-users mailing list