Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
Or lack direct applicability as we still didn't select a default OO style (minus - it's not helpful if a trivial one-line pattern requires 20 lines of interface glue to cope with both blessed hashes and blessed scalars).

What are you thinking of here? OO code in Perl shouldn't care whether an object is a blessed hash, a blessed scalar, a blessed nuisance, inside-out, upside-down, a Moose, a Mouse, or even a C pointer with a thin XS wrapper. You have an opaque reference. You call methods on it without worrying what it points to.

The only case I can immediately think of where this can legitimately fall down is when you inherit from someone else's object in a way that involves you trying to store additional private data inside their blessed data structure. But there are well-known ways to avoid that. And considering that code reuse through inheritance is a dodgy thing in the first place, the dodginess factor goes through the roof when you don't even control the code you're reusing!

Maybe there are other cases where well-written code can go wrong, but all I can say is that I've never yet encountered any problems in Perl that I could attribute to the lack of a single official method of implementing objects. I may well be missing something, but this seems to me to be one of those things that is more about Perl being conceptually messy, than about that messiness causing real problems in practice.


In reply to Re^4: Questions from "Coders at Work" by Porculus
in thread Questions from "Coders at Work" by bsb

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!
  • 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, 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, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            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.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others meditating upon the Monastery: (2)
    As of 2014-10-22 03:35 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      For retirement, I am banking on:










      Results (112 votes), past polls