It makes my brain hurt



  • These sort of constructs are scattered throughout the code base I'm working on.

      'If running batch job
    If runBatchJob = False Then
    Else
    RunJob()
    ...
    ' yes, code goes here, in the else

    It's the sort of comment/code combo that makes your brain grind to a screeching, careening, sparking halt.  It's also the sort that makes you want to go slap the original programmer. 

    I just HATE wasting my mind away working with nasty little problems...  :(



  • So you do[not] love[hate] working with normal[inverse] logic?

    Be thankful that they didn't use real boolean variables!



  • You know, after working in the industry for many years, a lot of us have snide remarks for just about any WTF.  On the other hand, sometimes you come across a WTF that defies logic (har har) in so many ways that it's indescribable.

     

    Words fail me. 



  •  If True = -1 Then

       ' We can use it in a mathematical expression and really screw with your mind

      ' Or cause a student to fail their assignment which is really fun

    Else

      ' Play nice

    End If

     



  •  A similar WTF I recently saw.

    [code] 

     if (SomeConditional that actually uses a boolean)

    {

        all = "true";

    }

    *** Snip ***

     if (all == "true")

    [/code] 

    etc.

    Words fail me. 



  •  Lets try that again, this editor sucks.

    [code]if (SomeConditonal that uses a boolean)
    {
    All="true";
    }

    *** SNIP ***

    if (All == "true")
    {
    etc...
    }[/code]



  • @Jonathan Holland said:

     Lets try that again, this editor sucks.

    Awesome. 

    "I don't need this now, but let's set it anyways." 

    It's pretty easy to see that this construct might be used correctly, but far more likely that the coder just doesn't understand how to program.  Probably learned how to program over the phone.



  • The real WTF is the use of a string for a boolean 



  • @Jonathan Holland said:

    The real WTF is the use of a string for a boolean

    Your grasp of the obvious is astounding.



  • @Jonathan Holland said:

    The real WTF is the use of a string for a boolean with no File_Not_Found option.

     

    Fixed that for you.



  • @Jonathan Holland said:

    The real WTF is the use of a string for a boolean 

    Maybe there are varying levels of "true" signified by which letters are capitalized.  "true" is less true than "True" which is less true than "TRue" which is less true than "FILE_NOT_FOUND" which is less true than "TRUE" which is the most ultimate of truths.  

    Similarly with "false" 



  •  @belgariontheking said:

    @Jonathan Holland said:

    The real WTF is the use of a string for a boolean 

    Maybe there are varying levels of "true" signified by which letters are capitalized.  "true" is less true than "True" which is less true than "TRue" which is less true than "FILE_NOT_FOUND" which is less true than "TRUE" which is the most ultimate of truths.  

    Similarly with "false" 

    As long as you dont get a TRUE!!!!!1!!!!!ELeVENTY!!!!!!!!



  • @belgariontheking said:

    Maybe there are varying levels of "true" signified by which letters are capitalized.  "true" is less true than "True" which is less true than "TRue" which is less true than "FILE_NOT_FOUND" which is less true than "TRUE" which is the most ultimate of truths.  

    Similarly with "false" 

    Ah, but where do "true2", "not true" and "not false" fit into that scheme of yours, eh? Thought we wouldn't notice that one, didn't you!


  • @belgariontheking said:

    @Jonathan Holland said:

    The real WTF is the use of a string for a boolean 

    Maybe there are varying levels of "true" signified by which letters are capitalized.  "true" is less true than "True" which is less true than "TRue" which is less true than "FILE_NOT_FOUND" which is less true than "TRUE" which is the most ultimate of truths.  

    Similarly with "false" 

     

    Diagnosis: The project manager spent his weekend reading up on quantum computing and how it would be much faster than a regular computer.


Log in to reply