Out-of-the-box workflow at it's best



  • It's my last day today.  For the last couple of years I've had to work with a CMS (Content Management System) 'product'.  One of the features that you'd expect a CMS to provide is some form of workflow, i.e. a business process that passes an item of content through an approval process.

    Apparently the 'product' we purchased (which incidentally the choice of which did not include a single developer who would have to use it) has an 'out-of-the-box' workflow solution.

    Here it is:

            <c:if test="${( ( currentUserCheckedOut == false ) && ( item!=null )) && ( ( ( fn:contains(groupIds,',1,') ) && ( item==null ) ) || ( ( ( fn:contains(groupIds,',1,') ) && ( item!=null ) && (attribute_status == 'RFE') ) || ( ( fn:contains(groupIds,',1,') ) && ( item!=null ) && ( attribute_status == 'Contributor' ) && (keywords_value == 'New') ) || ( ( fn:contains(groupIds,',1,') ) && ( item!=null ) && ( attribute_status == 'Contributor' ) && (keywords_value == 'Draft') ) || ( ( fn:contains(groupIds,',1,') ) && ( item!=null ) && ( attribute_status == 'Contributor' ) && (keywords_value == 'Rejected') ) ) || ( ( ( fn:contains(groupIds,',1,') ) && ( item!=null ) && (attribute_status == 'RFE') ) || ( ( fn:contains(groupIds,',1,') ) && ( item!=null ) && ( attribute_status == 'Contributor' ) && (keywords_value == 'New') ) || ( ( fn:contains(groupIds,',1,') ) && ( item!=null ) && ( attribute_status == 'Contributor' ) && (keywords_value == 'Draft') ) || ( ( fn:contains(groupIds,',1,') ) && ( item!=null ) && ( attribute_status == 'Contributor' ) && (keywords_value == 'Rejected') ) ) || ( ( fn:contains(groupIds,',2,') ) && ( item==null ) ) || ( ( ( fn:contains(groupIds,',2,') ) && ( item!=null ) && (attribute_status == 'RFE') ) || ( ( fn:contains(groupIds,',2,') ) && ( item!=null ) && ( attribute_status == 'Editor' ) && (keywords_value == 'New') ) || ( ( fn:contains(groupIds,',2,') ) && ( item!=null ) && ( attribute_status == 'Editor' ) && (keywords_value == 'Draft') ) || ( ( fn:contains(groupIds,',2,') ) && ( item!=null ) && ( attribute_status == 'Editor' ) && (keywords_value == 'Rejected') ) || ( ( fn:contains(groupIds,',2,') ) && ( item!=null ) && ( attribute_status == 'Editor' ) && (keywords_value == 'AwaitingApproval') ) ) || ( ( ( fn:contains(groupIds,',2,') ) && ( item!=null ) && (attribute_status == 'RFE') ) || ( ( fn:contains(groupIds,',2,') ) && ( item!=null ) && ( attribute_status == 'Editor' ) && (keywords_value == 'New') ) || ( ( fn:contains(groupIds,',2,') ) && ( item!=null ) && ( attribute_status == 'Editor' ) && (keywords_value == 'Draft') ) || ( ( fn:contains(groupIds,',2,') ) && ( item!=null ) && ( attribute_status == 'Editor' ) && (keywords_value == 'Rejected') ) || ( ( fn:contains(groupIds,',2,') ) && ( item!=null ) && ( attribute_status == 'Editor' ) && (keywords_value == 'AwaitingApproval') ) ) || ( ( ( fn:contains(groupIds,',2,') ) && ( item!=null ) && ( attribute_status == 'Editor' ) && (keywords_value == 'Draft') ) || ( ( fn:contains(groupIds,',2,') ) && ( item!=null ) && ( attribute_status == 'Editor' ) && (keywords_value == 'AwaitingApproval') ) ) || ( ( fn:contains(groupIds,',63,') ) && ( item==null ) ) || ( ( ( fn:contains(groupIds,',63,') ) && ( item!=null ) && (attribute_status == 'RFE') ) || ( ( fn:contains(groupIds,',63,') ) && ( item!=null ) && ( attribute_status == 'CorporateEditor' ) && (keywords_value == 'New') ) || ( ( fn:contains(groupIds,',63,') ) && ( item!=null ) && ( attribute_status == 'CorporateEditor' ) && (keywords_value == 'Draft') ) || ( ( fn:contains(groupIds,',63,') ) && ( item!=null ) && ( attribute_status == 'CorporateEditor' ) && (keywords_value == 'Rejected') ) ) || ( ( ( fn:contains(groupIds,',63,') ) && ( item!=null ) && (attribute_status == 'RFE') ) || ( ( fn:contains(groupIds,',63,') ) && ( item!=null ) && ( attribute_status == 'CorporateEditor' ) && (keywords_value == 'New') ) || ( ( fn:contains(groupIds,',63,') ) && ( item!=null ) && ( attribute_status == 'CorporateEditor' ) && (keywords_value == 'Draft') ) || ( ( fn:contains(groupIds,',63,') ) && ( item!=null ) && ( attribute_status == 'CorporateEditor' ) && (keywords_value == 'Rejected') ) ) || ( ( fn:contains(groupIds,',32,') ) && ( item==null ) ) || ( ( ( fn:contains(groupIds,',32,') ) && ( item!=null ) && (attribute_status == 'RFE') ) || ( ( fn:contains(groupIds,',32,') ) && ( item!=null ) && ( attribute_status == 'Approver' ) && (keywords_value == 'New') ) || ( ( fn:contains(groupIds,',32,') ) && ( item!=null ) && ( attribute_status == 'Approver' ) && (keywords_value == 'Draft') ) || ( ( fn:contains(groupIds,',32,') ) && ( item!=null ) && ( attribute_status == 'Approver' ) && (keywords_value == 'Rejected') ) || ( ( fn:contains(groupIds,',32,') ) && ( item!=null ) && ( attribute_status == 'Approver' ) && (keywords_value == 'AwaitingApproval') ) ) || ( ( ( fn:contains(groupIds,',32,') ) && ( item!=null ) && (attribute_status == 'RFE') ) || ( ( fn:contains(groupIds,',32,') ) && ( item!=null ) && ( attribute_status == 'Approver' ) && (keywords_value == 'New') ) || ( ( fn:contains(groupIds,',32,') ) && ( item!=null ) && ( attribute_status == 'Approver' ) && (keywords_value == 'Draft') ) || ( ( fn:contains(groupIds,',32,') ) && ( item!=null ) && ( attribute_status == 'Approver' ) && (keywords_value == 'Rejected') ) || ( ( fn:contains(groupIds,',32,') ) && ( item!=null ) && ( attribute_status == 'Approver' ) && (keywords_value == 'AwaitingApproval') ) ) || ( ( ( fn:contains(groupIds,',32,') ) && ( item!=null ) && ( attribute_status == 'Approver' ) && (keywords_value == 'Draft') ) || ( ( fn:contains(groupIds,',32,') ) && ( item!=null ) && ( attribute_status == 'Approver' ) && (keywords_value == 'AwaitingApproval') ) ) || ( ( fn:contains(groupIds,',64,') ) && ( item==null ) ) || ( ( ( fn:contains(groupIds,',64,') ) && ( item!=null ) && (attribute_status == 'RFE') ) || ( ( fn:contains(groupIds,',64,') ) && ( item!=null ) && ( attribute_status == 'CorporateApprover' ) && (keywords_value == 'New') ) || ( ( fn:contains(groupIds,',64,') ) && ( item!=null ) && ( attribute_status == 'CorporateApprover' ) && (keywords_value == 'Draft') ) || ( ( fn:contains(groupIds,',64,') ) && ( item!=null ) && ( attribute_status == 'CorporateApprover' ) && (keywords_value == 'Rejected') ) || ( ( fn:contains(groupIds,',64,') ) && ( item!=null ) && ( attribute_status == 'CorporateApprover' ) && (keywords_value == 'AwaitingApproval') ) ) || ( ( ( fn:contains(groupIds,',64,') ) && ( item!=null ) && (attribute_status == 'RFE') ) || ( ( fn:contains(groupIds,',64,') ) && ( item!=null ) && ( attribute_status == 'CorporateApprover' ) && (keywords_value == 'New') ) || ( ( fn:contains(groupIds,',64,') ) && ( item!=null ) && ( attribute_status == 'CorporateApprover' ) && (keywords_value == 'Draft') ) || ( ( fn:contains(groupIds,',64,') ) && ( item!=null ) && ( attribute_status == 'CorporateApprover' ) && (keywords_value == 'Rejected') ) || ( ( fn:contains(groupIds,',64,') ) && ( item!=null ) && ( attribute_status == 'CorporateApprover' ) && (keywords_value == 'AwaitingApproval') ) ) || ( ( ( fn:contains(groupIds,',64,') ) && ( item!=null ) && ( attribute_status == 'CorporateApprover' ) && (keywords_value == 'Draft') ) || ( ( fn:contains(groupIds,',64,') ) && ( item!=null ) && ( attribute_status == 'CorporateApprover' ) && (keywords_value == 'AwaitingApproval') ) ) || ( ( fn:contains(groupIds,',3,') ) && ( item==null ) ) || ( ( ( fn:contains(groupIds,',3,') ) && ( item!=null ) && (attribute_status == 'RFE') ) || ( ( fn:contains(groupIds,',3,') ) && ( item!=null ) && ( attribute_status == 'Publisher' ) && (keywords_value == 'New') ) || ( ( fn:contains(groupIds,',3,') ) && ( item!=null ) && ( attribute_status == 'Publisher' ) && (keywords_value == 'Draft') ) || ( ( fn:contains(groupIds,',3,') ) && ( item!=null ) && ( attribute_status == 'Publisher' ) && (keywords_value == 'AwaitingApproval') ) ) || ( ( ( fn:contains(groupIds,',3,') ) && ( item!=null ) && (attribute_status == 'RFE') ) || ( ( fn:contains(groupIds,',3,') ) && ( item!=null ) && ( attribute_status == 'Publisher' ) && (keywords_value == 'New') ) || ( ( fn:contains(groupIds,',3,') ) && ( item!=null ) && ( attribute_status == 'Publisher' ) && (keywords_value == 'Draft') ) || ( ( fn:contains(groupIds,',3,') ) && ( item!=null ) && ( attribute_status == 'Publisher' ) && (keywords_value == 'AwaitingApproval') ) ) || ( ( ( fn:contains(groupIds,',3,') ) && ( item!=null ) && ( attribute_status == 'Publisher' ) && (keywords_value == 'AwaitingApproval') ) || ( ( fn:contains(groupIds,',3,') ) && ( item!=null ) && ( attribute_status == 'Publisher' ) && (keywords_value == 'AwaitingApproval') ) ) )}">

    This is a JSP fragment by the way.

     

     



  • My God! It's full of ANDs! (and ORs)



  • My mouth is literally agape.

    D:

     

    It's comparable in insanity to that INF-screen SQL query we saw a long time ago on the Front Page.



  • If you blur your eyes it looks a bit like a snakes-and-ladders board.



  • It's even worse formatted properly:



    ( ( currentUserCheckedOut == false ) && ( item!=null ) ) &&
    (
      ( ( fn:contains(groupIds,',1,') ) && ( item==null ) ) ||
      (
        ( ( fn:contains(groupIds,',1,') ) && ( item!=null ) && ( attribute_status == 'RFE' ) ) ||
        ( ( fn:contains(groupIds,',1,') ) && ( item!=null ) && ( attribute_status == 'Contributor' ) && (keywords_value == 'New') ) ||
        ( ( fn:contains(groupIds,',1,') ) && ( item!=null ) && ( attribute_status == 'Contributor' ) && (keywords_value == 'Draft') ) ||
        ( ( fn:contains(groupIds,',1,') ) && ( item!=null ) && ( attribute_status == 'Contributor' ) && (keywords_value == 'Rejected') )
      ) ||
      (
        ( ( fn:contains(groupIds,',1,') ) && ( item!=null ) && ( attribute_status == 'RFE' ) ) ||
        ( ( fn:contains(groupIds,',1,') ) && ( item!=null ) && ( attribute_status == 'Contributor' ) && (keywords_value == 'New') ) ||
        ( ( fn:contains(groupIds,',1,') ) && ( item!=null ) && ( attribute_status == 'Contributor' ) && (keywords_value == 'Draft') ) ||
        ( ( fn:contains(groupIds,',1,') ) && ( item!=null ) && ( attribute_status == 'Contributor' ) && (keywords_value == 'Rejected') )
      ) ||
      ( ( fn:contains(groupIds,',2,') ) && ( item==null ) ) ||
        ( ( fn:contains(groupIds,',2,') ) && ( item!=null ) && ( attribute_status == 'RFE' ) ) ||
        ( ( fn:contains(groupIds,',2,') ) && ( item!=null ) && ( attribute_status == 'Editor' ) && (keywords_value == 'New') ) ||
        ( ( fn:contains(groupIds,',2,') ) && ( item!=null ) && ( attribute_status == 'Editor' ) && (keywords_value == 'Draft') ) ||
        ( ( fn:contains(groupIds,',2,') ) && ( item!=null ) && ( attribute_status == 'Editor' ) && (keywords_value == 'Rejected') ) ||
        ( ( fn:contains(groupIds,',2,') ) && ( item!=null ) && ( attribute_status == 'Editor' ) && (keywords_value == 'AwaitingApproval') )
      ) ||
      (
        ( ( fn:contains(groupIds,',2,') ) && ( item!=null ) && ( attribute_status == 'RFE') ) ||
        ( ( fn:contains(groupIds,',2,') ) && ( item!=null ) && ( attribute_status == 'Editor' ) && (keywords_value == 'New') ) ||
        ( ( fn:contains(groupIds,',2,') ) && ( item!=null ) && ( attribute_status == 'Editor' ) && (keywords_value == 'Draft') ) ||
        ( ( fn:contains(groupIds,',2,') ) && ( item!=null ) && ( attribute_status == 'Editor' ) && (keywords_value == 'Rejected') ) ||
        ( ( fn:contains(groupIds,',2,') ) && ( item!=null ) && ( attribute_status == 'Editor' ) && (keywords_value == 'AwaitingApproval') )
      ) ||
      (
        ( ( fn:contains(groupIds,',2,') ) && ( item!=null ) && ( attribute_status == 'Editor' ) && (keywords_value == 'Draft') ) ||
        ( ( fn:contains(groupIds,',2,') ) && ( item!=null ) && ( attribute_status == 'Editor' ) && (keywords_value == 'AwaitingApproval') )
      ) ||
      ( ( fn:contains(groupIds,',63,') ) && ( item==null ) ) ||
        ( ( fn:contains(groupIds,',63,') ) && ( item!=null ) && ( attribute_status == 'RFE') ) ||
        ( ( fn:contains(groupIds,',63,') ) && ( item!=null ) && ( attribute_status == 'CorporateEditor' ) && (keywords_value == 'New') ) ||
        ( ( fn:contains(groupIds,',63,') ) && ( item!=null ) && ( attribute_status == 'CorporateEditor' ) && (keywords_value == 'Draft') ) ||
        ( ( fn:contains(groupIds,',63,') ) && ( item!=null ) && ( attribute_status == 'CorporateEditor' ) && (keywords_value == 'Rejected') )
      ) ||
      (
        ( ( fn:contains(groupIds,',63,') ) && ( item!=null ) && ( attribute_status == 'RFE') ) ||
        ( ( fn:contains(groupIds,',63,') ) && ( item!=null ) && ( attribute_status == 'CorporateEditor' ) && (keywords_value == 'New') ) ||
        ( ( fn:contains(groupIds,',63,') ) && ( item!=null ) && ( attribute_status == 'CorporateEditor' ) && (keywords_value == 'Draft') ) ||
        ( ( fn:contains(groupIds,',63,') ) && ( item!=null ) && ( attribute_status == 'CorporateEditor' ) && (keywords_value == 'Rejected') )
      ) ||
      ( ( fn:contains(groupIds,',32,') ) && ( item==null ) ) ||
      (
        ( ( fn:contains(groupIds,',32,') ) && ( item!=null ) && ( attribute_status == 'RFE') ) ||
        ( ( fn:contains(groupIds,',32,') ) && ( item!=null ) && ( attribute_status == 'Approver' ) && (keywords_value == 'New') ) ||
        ( ( fn:contains(groupIds,',32,') ) && ( item!=null ) && ( attribute_status == 'Approver' ) && (keywords_value == 'Draft') ) ||
        ( ( fn:contains(groupIds,',32,') ) && ( item!=null ) && ( attribute_status == 'Approver' ) && (keywords_value == 'Rejected') ) ||
        ( ( fn:contains(groupIds,',32,') ) && ( item!=null ) && ( attribute_status == 'Approver' ) && (keywords_value == 'AwaitingApproval') )
      ) ||
      (
        ( ( fn:contains(groupIds,',32,') ) && ( item!=null ) && ( attribute_status == 'RFE') ) ||
        ( ( fn:contains(groupIds,',32,') ) && ( item!=null ) && ( attribute_status == 'Approver' ) && (keywords_value == 'New') ) ||
        ( ( fn:contains(groupIds,',32,') ) && ( item!=null ) && ( attribute_status == 'Approver' ) && (keywords_value == 'Draft') ) ||
        ( ( fn:contains(groupIds,',32,') ) && ( item!=null ) && ( attribute_status == 'Approver' ) && (keywords_value == 'Rejected') ) ||
        ( ( fn:contains(groupIds,',32,') ) && ( item!=null ) && ( attribute_status == 'Approver' ) && (keywords_value == 'AwaitingApproval') )
      ) ||
      (
        ( ( fn:contains(groupIds,',32,') ) && ( item!=null ) && ( attribute_status == 'Approver' ) && (keywords_value == 'Draft') ) ||
        ( ( fn:contains(groupIds,',32,') ) && ( item!=null ) && ( attribute_status == 'Approver' ) && (keywords_value == 'AwaitingApproval') )
      ) ||
      ( ( fn:contains(groupIds,',64,') ) && ( item==null ) ) ||
      (
        ( ( fn:contains(groupIds,',64,') ) && ( item!=null ) && ( attribute_status == 'RFE') ) ||
        ( ( fn:contains(groupIds,',64,') ) && ( item!=null ) && ( attribute_status == 'CorporateApprover' ) && (keywords_value == 'New') ) ||
        ( ( fn:contains(groupIds,',64,') ) && ( item!=null ) && ( attribute_status == 'CorporateApprover' ) && (keywords_value == 'Draft') ) ||
        ( ( fn:contains(groupIds,',64,') ) && ( item!=null ) && ( attribute_status == 'CorporateApprover' ) && (keywords_value == 'Rejected') ) ||
        ( ( fn:contains(groupIds,',64,') ) && ( item!=null ) && ( attribute_status == 'CorporateApprover' ) && (keywords_value == 'AwaitingApproval') )
      ) ||
      (
        ( ( fn:contains(groupIds,',64,') ) && ( item!=null ) && ( attribute_status == 'RFE') ) ||
        ( ( fn:contains(groupIds,',64,') ) && ( item!=null ) && ( attribute_status == 'CorporateApprover' ) && (keywords_value == 'New') ) ||
        ( ( fn:contains(groupIds,',64,') ) && ( item!=null ) && ( attribute_status == 'CorporateApprover' ) && (keywords_value == 'Draft') ) ||
        ( ( fn:contains(groupIds,',64,') ) && ( item!=null ) && ( attribute_status == 'CorporateApprover' ) && (keywords_value == 'Rejected') ) ||
        ( ( fn:contains(groupIds,',64,') ) && ( item!=null ) && ( attribute_status == 'CorporateApprover' ) && (keywords_value == 'AwaitingApproval') )
      ) ||
      (
        ( ( fn:contains(groupIds,',64,') ) && ( item!=null ) && ( attribute_status == 'CorporateApprover' ) && (keywords_value == 'Draft') ) ||
        ( ( fn:contains(groupIds,',64,') ) && ( item!=null ) && ( attribute_status == 'CorporateApprover' ) && (keywords_value == 'AwaitingApproval') )
      ) ||
      ( ( fn:contains(groupIds,',3,') ) && ( item==null ) ) ||
        ( ( fn:contains(groupIds,',3,') ) && ( item!=null ) && ( attribute_status == 'RFE') ) ||
        ( ( fn:contains(groupIds,',3,') ) && ( item!=null ) && ( attribute_status == 'Publisher' ) && (keywords_value == 'New') ) ||
        ( ( fn:contains(groupIds,',3,') ) && ( item!=null ) && ( attribute_status == 'Publisher' ) && (keywords_value == 'Draft') ) ||
        ( ( fn:contains(groupIds,',3,') ) && ( item!=null ) && ( attribute_status == 'Publisher' ) && (keywords_value == 'AwaitingApproval') )
      ) ||
      (
        ( ( fn:contains(groupIds,',3,') ) && ( item!=null ) && (attribute_status == 'RFE') ) ||
        ( ( fn:contains(groupIds,',3,') ) && ( item!=null ) && ( attribute_status == 'Publisher' ) && (keywords_value == 'New') ) ||
        ( ( fn:contains(groupIds,',3,') ) && ( item!=null ) && ( attribute_status == 'Publisher' ) && (keywords_value == 'Draft') ) ||
        ( ( fn:contains(groupIds,',3,') ) && ( item!=null ) && ( attribute_status == 'Publisher' ) && (keywords_value == 'AwaitingApproval') )
      ) ||
      (
        ( ( fn:contains(groupIds,',3,') ) && ( item!=null ) && ( attribute_status == 'Publisher' ) && (keywords_value == 'AwaitingApproval') ) ||
        ( ( fn:contains(groupIds,',3,') ) && ( item!=null ) && ( attribute_status == 'Publisher' ) && (keywords_value == 'AwaitingApproval') )
      )
    )

    Luckily for you, I think you can replace that pile with this:

    ( ! currentUserCheckedOut && item != null ) &&
    (
      fn:contains(groupIds,',1,') &&
      (
        ( attribute_status == 'RFE' ) ||
        ( attribute_status == 'Contributor' && ( keywords_value = 'New' || keywords_value == 'Draft' || keywords_value == 'Rejected' ) )
      ) ||
      fn:contains(groupIds,',2,') &&
      (
        ( attribute_status == 'RFE' ) ||
        ( attribute_status == 'Editor' && ( keywords_value = 'New' || keywords_value == 'Draft' || keywords_value == 'Rejected' || keywords_value == 'AwaitingApproval' ) )
      ) ||
      fn:contains(groupIds,',63,') &&
      (
        ( attribute_status == 'RFE' ) ||
        ( attribute_status == 'CorporateEditor' && ( keywords_value = 'New' || keywords_value == 'Draft' || keywords_value == 'Rejected' ) )
      ) ||
      fn:contains(groupIds,',32,') &&
      (
        ( attribute_status == 'RFE' ) ||
        ( attribute_status == 'CorporateEditor' && ( keywords_value = 'New' || keywords_value == 'Draft' || keywords_value == 'Rejected' || keywords_value == 'AwaitingApproval' ) )
      ) ||
      fn:contains(groupIds,',64,') &&
      (
        ( attribute_status == 'RFE' ) ||
        ( attribute_status == 'CorporateApprover' && ( keywords_value = 'New' || keywords_value == 'Draft' || keywords_value == 'Rejected' || keywords_value == 'AwaitingApproval' ) )
      ) ||
      fn:contains(groupIds,',3,') &&
      (
        ( attribute_status == 'RFE' ) ||
        ( attribute_status == 'Publisher' && ( keywords_value = 'New' || keywords_value == 'Draft' || keywords_value == 'AwaitingApproval' ) )
      )
    )



  • Tell me this is generated code. Please.

    Edit: oh well, this already came with the product. So I guess you can't tell.



  • So you can't deal with a little boolean logic in an if test? Sigh...and I bet you call yourself a programmer...



  • @mountain said:

    So you can't deal with a little boolean logic in an if test? Sigh...and I bet you call yourself a programmer...

    Sir, I'll have you know I spent two years in Boolea with the Peace Corps, and I speak Boolean like a native!

    The problem is that, unlike virtually every other person working today, I acknowledge that not everyone else has exactly the same set of skills I have, and I know from experience that this trainwreck of an if statement will find its way to the task-list of someone who doesn't grok the relative precedence of AND and OR.  My objection is not that I don't understand it myself, but that I foresee the result when John Q Clueless goes in to make that "one small change" that seems to be the basis of all software maintenance today.

     



  • @mountain said:

    So you can't deal with a little boolean logic in an if test? Sigh...and I bet you call yourself a programmer...

    Which of these pieces of code would you rather maintain?

    Exhibit A:

    if (x == 1) return false;

    Exhibit B:

    if ((x << 7) - 3 == 5 ** 3) return (x > 2);

    It behooves people who write complicated conditions to present them in the clearest form possible.

    (PS Nice troll, 7/10, and it's nice to have a bit of variety from time to time).



  •  I've been looking at this thing for 5 minutes now and I can't see anything. This is the worst stereogram ever.



  • @pjt33 said:

    Which of these pieces of code would you rather maintain?

    Exhibit A:

    if (x == 1) return false;

    Exhibit B:

    if ((x << 7) - 3 == 5 ** 3) return (x > 2);

     

    First thing I'd do is change Exhibit A to:

    return (x != 1);

    (The brackets are there as a service to the less-experienced people who will follow.)

     


  • Discourse touched me in a no-no place

    @da Doctah said:

    @pjt33 said:

    Which of these pieces of code would you rather maintain?

    Exhibit A:

    if (x == 1) return false;

    Exhibit B:

    if ((x << 7) - 3 == 5 ** 3) return (x > 2);

     

    First thing I'd do is change Exhibit A to:

    return (x != 1);

    I wouldn't - they're not equivalent.

  • Winner of the 2016 Presidential Election

    @DOA said:

     I've been looking at this thing for 5 minutes now and I can't see anything. This is the worst stereogram ever.

    Wow, it's a schooner.



  • @joe.edwards said:

    @DOA said:
     I've been looking at this thing for 5 minutes now and I can't see anything. This is the worst stereogram ever.

    Wow, it's a schooner.

     

    I thought it was a dick.

    A sizeable one, in fact.

     



  • @pjt33 said:

    @mountain said:
    So you can't deal with a little boolean logic in an if test? Sigh...and I bet you call yourself a programmer...

    Which of these pieces of code would you rather maintain?

    Exhibit A:

    if (x == 1) return false;

    Exhibit B:

    if ((x << 7) - 3 == 5 ** 3) return (x > 2);

    It behooves people who write complicated conditions to present them in the clearest form possible.

    (PS Nice troll, 7/10, and it's nice to have a bit of variety from time to time).

     

    At least I learned something today:

    Behoove: To be necessary or proper for: "It behooves you at least to try. "

     



  • @pjt33 said:

    (PS Nice troll, 7/10, and it's nice to have a bit of variety from time to time).
    Why attribute to trolling what can easierly* be explained as sarcasm?

    *I like wordinventing.

     



  • @Zecc said:

    Why attribute to trolling what can easierly* be explained as sarcasm?

    Bayesian statistics. By virtue of being posted on a TDWTF forum it has a prior which is heavily weighted towards being a troll.



  • @pjt33 said:

    @Zecc said:
    Why attribute to trolling what can easierly* be explained as sarcasm?

    Bayesian statistics. By virtue of being posted on a TDWTF forum it has a prior which is heavily weighted towards being a sarcastic troll.

    FTFY



  •  I suppose you can't add any roles then? Or if you do, you'll have to add them to that if statement...


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.