Thanks for the ref to the Beck book.

Yeah, it's all about Smalltalk, but most of the rules apply to any late-binding OO language like Perl.

Could you or some other knowledgeable monk clue me in about this business of "late-binding"? I googled the definition, but I'm having a much harder time finding some bird's-eye picture of the fundamental qualitative differences between OO languages that are late-binding and those that aren't. I vaguely gather that early-binding may be tied to strong typing, but this is just a guess.

Wanting to "call the code two levels up" or "call a method other than your own name" are both signs of muddled thinking or an extremely bad class design.

Yes, agreed, and I don't recall ever needing to do this in classes I have coded, but unfortunately one often has to work with class hierarchies designed by others. In fact, what motivated this meditation was a practical problem posted in SoPW; one simple solution to that problem amounted to "skipping the middle man".

Without knowing much of the OO theory behind it, I've figured that the ability to "skip the middleman" is, like the goto LABEL facility, something to use sparingly, but nice to have available for the once in a blue moon when you really need it (otherwise Perl would have simply disallowed it). But in light of your and adrianh's comments, I regret having made the whole maneuver sound as innocuous as I did.

the lowliest monk


In reply to Re^3: Skipping the middle man & the SUPER gotcha by tlm
in thread Skipping the middle man & the SUPER gotcha by tlm

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.