On Jan 13, 2004, at 12:05 PM, Rob Dixon wrote:

use base (Trainset::Trains Trainset::Track Trainset::Signals
  Trainset::Levers Trainset::Boxes);

inside Trainset.pm. Is this the correct way to call in the other
classes?

No it's not.


use Trainset::Trains;
use Trainset::Track;
use Trainset::Signals;
use Trainset::Levers;
use Trainset::Boxes;

Yes it is (sorry James). 'use' on it's own doesn't build the object dependencies. 'use base' is the right way to go, although I prefer

  our @ISA; # read 'is a'
  @ISA = qw/
    Trainset::Train
    Trainset::Track
    Trainset::Signal
    Trainset::Box
    Trainset::Box::Lever
  /;

Rob and I obviously view this differently. :D


I'm also beginning to understand a lot of the confusion in this thread. You two are thinking about this completely opposite the way I am. No problem, there's many solutions to every problem.

Gary and Rob, you two have been envisioning bringing all these methods together under one package using inheritance. I've been thinking of uniting these objects with an interface object that keeps track of all the gory details for the users.

I do prefer my line of thinking. I think it's pretty clear that the above is poor object oriented design (sorry Rob) since you are literally saying:

Trainset IS A Trainset::Train AND IS A Trainset::Track AND IS A ...

That's certainly not true in real life and I don't think we want it true in our code, pitfalls of multiple inheritance arguments not even needed.

The real problem I have with this whole line of thinking though is that you have to learn the details of six (or so) objects whens I think you're really only interested in them as a single entity. How you implement all of these internals is complex and I don't want to care about it when it's time for me to sit down and do something practical with a Trainset. I don't want to remember which constructor to call for what and which object's link() method will help me hook these things up. I just want to tell Trainset what I want and get some work done.

"Of course, that's just my opinion. I could be wrong." --Dennis Miller

James


-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to