if ( A && B && C ) { }
should be rewritten as
if ( is_AB( @stuff ) && is_C( @stuff ) ) { } sub is_AB { my @stuff = @_; return A && B; } sub is_C { my @stuff = @_; return C;
Even better would be using some set of useful objects that provide a useful interface for you.

Before anyone replies, please note that I'm saying "Decompose better and design with interfaces in mind." In other words, having read PBP, I'm agreeing with Damian's statements on the process of design. Not enough coders actually spend the 15 minutes to think through how the various pieces of their code are going to interact and then spend another 15 minutes diagramming out the separation of concerns. Long conditionals are a very smelly way of finding out that you don't understand the process you're attempting to have a computer do for you.


My criteria for good software:
  1. Does it work?
  2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?

In reply to Re: bloated 'if' formatting by dragonchild
in thread bloated 'if' formatting by eff_i_g

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.