Found this in subversion today.




  • I found this in my code today

            string sqlString = "";
            if (partyType != "C")
            {
                if (partyType == "B")
                {
    
                //do something.
    			System.println.out("----Coed completed without error----");
    
                }
            }
            else
            {
    
               //do something else.
    			System.println.out("----Coed completed without error----");
            }
    

    I have erase rest of code not having any relevance to WTF. The thing odd I find is that how is if condition written in this case. On future analyses, I find that only three possible value can exist for partyType variable. So why not go for switch syntax? Also no check for Nullable type make this code look like real WTF.



  •  This is what happens when you modify code on several separate occasions without considering the bigger picture.




  • Wow, I love completing the coeds! Although, that's not what we called it in my day.

    I doubt I would have resorted to a switch. Is, or was there something in common with parytTypes that were neither C nor B? I probably would have started with == "C", and then dealt with other stuff in the else. Or had "else if" blocks if the B and !(B || C) could be separated.



  • @boomzilla said:


    Wow, I love completing the coeds! Although, that's not what we called it in my day.

    I doubt I would have resorted to a switch. Is, or was there something in common with parytTypes that were neither C nor B? I probably would have started with == "C", and then dealt with other stuff in the else. Or had "else if" blocks if the B and !(B || C) could be separated.

    Going through database, there are 4 possible value for party_type: NULL, P, C and B. They are exclusive, but each record can transit from NULL -> P -> C -> B



  •  This is a situation where proper comments will assist in your understanding of the coed.



  • Why is this not in the Side Bar?

    Why is the code you work on so much better at english than you are?

    Where are the completed coeds? Pixplzkthx



  • @Sutherlands said:

    Why is this not in the Side Bar?

    Why is the code you work on so much better at english than you are?

    Where are the completed coeds? Pixplzkthx

    Simple explaining to be done here: Code going through review process. Post not going through any process

    It should written as "completed code". Co-ed is co-education which mean boy and girl in same class. I go to all boy school, so no co-education for me.


Log in to reply
 

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