I'm working on a medium-sized project and feel like I either:

  A. Still don't understand object-oriented programming

  -or-

  B. Am duplicating Ruby syntax which I'm not familiar with

First, a little background, (kept mercifully short,) I'm working on a 
survey interviewing program.  I'm having having trouble with hammering 
classes into a structure:

Interview
  Questions
    Question
      Answers
      Contents
      RHTML
  Control
  Answers

I've been told that ideally, classes like "Answers" shouldn't know 
anything about other classes like "Control"; but in practice, it's 
really convenient for Answer's methods to talk to Control's public 
methods and vice versa.

Here's a sexy graph:

  Interview.control <=> Interview.questions.question.answers

When implementing this, to give these classes a "channel" to talk to 
each other, I've ended up passing each "parent" object to the "child" 
object at the child's creation.  Let me show you what I'm talking about:

 class Question
  def initialize(interview, questions)
    self.interview = interview
    self.questions = question

    self.answers  =  Answers.new(self.interview, self.questions, self)
    self.contents = Contents.new(self.interview, self.questions, self)
    self.rhtml    =    RHTML.new(self.interview, self.questions, self)
  end
 end

In english, to be created, Question demands to be passed its Questions 
"parent" and Interview "grandparent", then passes these "ancestors" and 
itself on to its children.  Thankfully the children don't have any child 
objects of their own so we're not creating any four parameter objects, 
but still...

I feel like this must be the programming equivalent of eating at a fancy 
restaurant with your feet.  I fear I'm going to be thrown out of the 
programmer's union.

Please help!  Does ruby have a better way to emphasize structure between 
classes?

-- 
Posted via http://www.ruby-forum.com/.