In my office, we're working on a project right now that is massively OO, with deep levels of inheritance and complex relationships. This is the most complex OO project I've ever worked on, and it's being done entirely in perl with the mindset that later parts or all of it will be ported to Java and possibly C. With that in mind, I'll tell you what we've come up with:

We're not using Class::Struct and/or Class::MethodMaker. I can't really say why other than we don't really need it.

Documentation is key. All our modules start out with their documentation first, and things are documented before their implemented (so if I say, add a feature that requires a method or object variable, I write the documentation first). After documentation comes tests based on that documentation, and then code.

When dealing with inheritance, about the only thing we take for granted is the internal structure of the object (a hash, in almost all cases). For everything else, we use only fully documented features. We may know that the 'variable' entry exists in our hashref, but if it's not documented, we don't use it. If we need access to that entry, we either document the entry or (more often) code in a method to access it.

With that in mind, our code is actually surprisingly simple. Modules are tiny in terms of length of code and the efficiency of the system, while constantly being tweaked, is actually very good. We're not doing some things where we could (for example, we don't use AUTOLOAD because the complications that arise when porting that function to other languages make it a bit of a hassle), but for the most part, the pieces fit together.

So I would say the major thing is documentation. It doesn't really matter how you do things, just as long as everyone is clear on how they are being done. That requires extensive detailing of what you can and can't do, and then a strict adherence to those details.

Do that, and you can implement objects however you want.


In reply to Re: preferred/standard object implementations? by Hrunting
in thread preferred/standard object implementations? by dshahin

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.