On Tue, Jul 2, 2013 at 2:14 AM, Andrew S. <lists / ruby-forum.com> wrote:

> I'm apparently missing something fundamental in my knowledge of classes
> and how they interoperate.
>


> Essentially, I have about 20 classes and many of them talk to each
> other, so they have to be aware of each other.  What's the right way to
> structure all of this?


You have received excellent replies already.  I'd just like to point out
one detail: you do not necessarily want to make classes aware of each other
but rather instances.  Indirectly this, of course, makes classes aware of
each other via the knowledge of methods to be called that each has.

One way to achieve what you want may be to have a method somewhere which
configures a set of objects knowing each other and returns an instance used
as an entry point.

But we're hugely speculating here as long as we do not see the real
purposes of those classes.  Without that it's impossible to suggest a
proper pattern.  This cannot be done with Foo and Bar.

Kind regards

robert


-- 
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/