Here's my take on it.

The idea behind your system, it seems to me, is that you want objects that are basically input-output neutral: they can be read from anywhere, and they can be written to anywhere. So what you want (and it sounds like what you have) is a series of polymorphic input and output drivers, such that you can provide a transparent transparent interface to the various input and output sources.

With that said, then, I would have one main object that doesn't inherit from anything. That object, in my system, would be of type "Obj". That's it. It would maintain *state* about its input and output drivers, so that when it came time to read and write this object, you could dispatch to the appropriate driver. So I might say:

my $obj = Obj->get('DB', @params);
and this would, under the hood, do the following: You could then set the output for your object, and do something much similar: load the proper class; call that class's "put" (or whatever) method.

The reason I would bless my object into Obj, rather than into a driver-specific input class, is that I find that confusing: your object is generic, and it's not tied to a particular input class. So why add restrictions that aren't already there?

With respect to inheritance, I'd have a main Obj class that inherits from nothing. That's your main object class. Then either one of two things:

I don't know which I'd choose. The second option feels cleaner to me. But then what do I know.

In reply to RE: Object Heirarchy / Design by btrott
in thread Object Heirarchy / Design by lattice

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.