Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

To the “down-voters” among you, who may mistake brevity for lack of wisdom or experience, I invite your reconsideration.   Here’s why.

The “clever improvements” as suggested cause each of the various if cases to become coupled.   In other words, as long as each and every if-case that could possibly be required, for the entire service lifetime of this application (which could be a decade or more), is identical ... the code is “clever,” and perhaps it may look a wee bit more agreeable to the digestion.

However ...

Change will come.   Some day, a condition will need to be added that will break the rule.   And, when that happens, suddenly the code that is working properly now must be torn-apart, more or less, and recoded.   What was meant to be clever has just turned bad, and it de-stabilized all of the logic that it “cleverly” tied together.   Whereas, if the “ugly” if..elsif structure had simply been retained, no changes to any of the existing code, with its admittedly repetitive structure, would have been required.   You would simply need to add another elsif block at the appropriate point.   You can keep that up indefinitely.

Please bear in mind that I have spent most of my career in “code rescue” and project-turnarounds.   Which means that my perspective on such things is somewhat like that of a coroner.   Such “cleverness,” well-intentioned though it once may have been, after a surprisingly short amount of time attracts a large number of blowflies.   Maintainability is king, and software must be designed in anticipation of a very long service life involving many different people.   You won’t be at that job forever ... but your work will be, and someday I might be called in to have a look.

In reply to Re^2: Short and easy way to write if...elsif syntax by sundialsvc4
in thread Short and easy way to write if...elsif syntax by slayedbylucifer

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, 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
  • 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.
  • Log In?

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

    How do I use this? | Other CB clients
    Other Users?
    Others contemplating the Monastery: (5)
    As of 2019-04-19 22:28 GMT
    Find Nodes?
      Voting Booth?
      I am most likely to install a new module from CPAN if:

      Results (107 votes). Check out past polls.

      • (Sep 10, 2018 at 22:53 UTC) Welcome new users!