Communication between objects

I posted a question on this topic yesterday but used an example
specific to my application. But I wanted to re-post with a slightly
more abstract example and see what responses there are. My question:
How does ruby implement passing messages between objects.

An example might be a course registration system. In this system you
have student objects and a registration object. Your student object
can call the method student.register_for_course method. Now, before the
studen can register for the course we need to make sure the student has
met all the prerequisites. So ideally the student object would pass
the request to the registration object along with the name of the
course, the students id, etc. The registration object would call the
registration.prerequisite_met? method. Then it would return the
response back to the student object which could then procede with
either registering for the class or indicate that registration would
not be allowed.

Someone yesterday said you would create a superclass that both of these
objects would share and this superclass would handle communication
between the objects. I can see how that would work. But is that the
only way? Is there no way for ruby objects to communicate directly with
one another?

Thanks. TOD

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs