You have no context of my implementation to immediately assume ... that I am in fact creating spaghetti code.

Sorry. But when you said:

it is useful to know the action being executed to validate for certain parameters to execute that action.

you gave me that context.

A subroutine or method that needs to know where it is called from, in order to validate its arguments, *is* spaghetti code.

It means that each time you need to call that subroutine from a new piece of code, you have to modify the subroutine to handle the new caller. And that type of codependency-at-a-distance is the modern reincarnation of spaghetti coding.


And for the record, as anyone familiar with my writings here will confirm, I'm not at all religious about OO. Indeed, I'm kinda known for railing against the dogmatic overuse of OO.

Nor am I religious about any other particular coding methodology. OO, used appropriately and correctly, is just another tool in the coders toolbox. Along with FP, and procedural, and event driven and any other you care to name.

But there are certain fundamental principles in coding that hold true across all coding styles, and loose coupling is one such.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
RIP an inspiration; A true Folk's Guy

In reply to Re^7: Moose and caller() for current method by BrowserUk
in thread Moose and caller() for current method by ait

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.