• Yep (unregistered)

    frist || no frist

  • (cs)

    I think the only solution is to wire pepper spray to certain people's keyboards and have it activate when Ctrl + C is pressed.

  • Guru (unregistered)

    This illustrates two of the fundamental axioms of development:

    1. Given a piece of code, there must necessarily exist a more obfuscated and less readable way to write the same functionality

    2. When encountering an if-ten statement that you don't necessarily understand, it is your duty as a programmer to add more &&s and ||s until it meets the needs of your particular bug fix (f*** testing the other, existing requirements)

  • (cs)

    I don't even see &, | or () anymore. All I see is brunette, redhead...

  • the beholder (unregistered)

    I loved the "*".equalsIgnoreCase(sub.getReplaceOn())

    It would be very bad have an uppercase asterisk slip unmatched against whatever that is.

  • (cs) in reply to DOA
    DOA:
    I think the only solution is to wire pepper spray to certain people's keyboards and have it activate when Ctrl + C is pressed.

    +1 Best idea ever.

  • Markus (unregistered) in reply to apaq11
    apaq11:
    I don't even see &, | or () anymore. All I see is brunette, redhead...

    +1 :D

  • Jaybles (unregistered) in reply to DOA
    DOA:
    I think the only solution is to wire pepper spray to certain people's keyboards and have it activate when Ctrl + C is pressed.

    They would simply learn to copy/paste using context menus. You know, assuming the didn't go blind from the first couple sprays.

  • asdf (unregistered)

    The purpose? Job security.

  • TheSHEEEP (unregistered)

    This is madness!

  • Skilldrick (unregistered)

    TRWTF is using spaces instead of tabs.

  • Doodle (unregistered) in reply to Markus
    Markus:
    apaq11:
    I don't even see &, | or () anymore. All I see is brunette, redhead...

    +1 :D

    ++1

  • (cs)

    a big differently?

    Alex, hand over your English mastery card, I need to take a corner off it.

  • Pope (unregistered)

    Purpose: nepotism?

  • Skilldrick (unregistered) in reply to Skilldrick
    Skilldrick:
    TRWTF is using spaces instead of tabs.

    Of course, I meant "using tabs instead of spaces". :P

  • ih8u (unregistered) in reply to Hasteur
    Hasteur:
    a big differently?

    Alex, hand over your English mastery card, I need to take a corner off it.

    It's not really a mastery of English problem. It's a reading-what-i-just-wrote problem. Spell check doesn't catch errors if the errors are legitimate words.

    I no I always check every thing that I wrote online to made sure that it is well wrote.

    To all who would post a thing online:

    Just take the time to read a post as though you were reading it for the first time. It's hard to find the extra minute or so, but it sure saves WTF readers a LOT of crying and wet pants.

    CAPTCHA: capio -- to seize (it's not fun when it's actual Latin)

  • anonymous (unregistered) in reply to ih8u
    ih8u:

    It's not really a mastery of English problem. It's a reading-what-i-just-wrote problem. Spell check doesn't catch errors if the errors are legitimate words.

    I no I always check every thing that I wrote online to made sure that it is well wrote.

    To all who would post a thing online:

    Just take the time to read a post as though you were reading it for the first time. It's hard to find the extra minute or so, but it sure saves WTF readers a LOT of crying and wet pants.

    I hope you're kidding. I no there is no way you took the time when posting a thing.

  • (cs) in reply to Jaybles
    Jaybles:
    DOA:
    I think the only solution is to wire pepper spray to certain people's keyboards and have it activate when Ctrl + C is pressed.

    They would simply learn to copy/paste using context menus. You know, assuming the didn't go blind from the first couple sprays.

    Think about the sort of people we're dealing with here. The copy/paste buttons are probably the only way they know how to do it.

  • BrainFsck (unregistered)

    "Perhaps you can figure out what those purposes are after reading this simple, single line of code."

    To cause an aneurysm and to ensure job security?

  • wtf (unregistered) in reply to Doodle
    Doodle:
    Markus:
    apaq11:
    I don't even see &, | or () anymore. All I see is brunette, redhead...

    +1 :D

    ++1

    Damn you, now 1==2 and math's all screwed up. Someone call Russell and Whitehead in, we need to reboot.

  • Eaten by a Grue (unregistered) in reply to TheSHEEEP
    TheSHEEEP:
    This is madness!

    THIS IS TDWTF!!! /kicks TheSHEEEP into a bottomless pit

  • wtf (unregistered) in reply to DOA
    DOA:
    I think the only solution is to wire pepper spray to certain people's keyboards and have it activate when Ctrl + C is pressed.

    I don't get it. Why would you want to mace someone for cancelling a job?

  • shotcircut (unregistered)

    The real WTF... The code will cause a NullPointerException...

    params.get(sub.getParentField().toLowerCase()).getValue().equalsIgnoreCase(sub.getReplaceOn())
    is FOLLOWED by tests as to whether it exists.

    The clearer? form:

    String field = sub.getParentField().toLowerCase();
    if(	params.containsKey( field ) && 
    	params.get( field ).getValue().equalsIgnoreCase(sub.getReplaceOn())  && 
    	params.containsKey( sub.getFieldName().toLowerCase() ) ) {
    
  • Matt Westwood (unregistered)

    Suggestions, then.

    Training: "See how many things you can find wrong with this code."

    Or: "The MD is a stand-up comedian in his other life and he needs some material."

    Or: "We need to hide the fact from the big bad headhunters that we have talent here, so we give them examples of stuff like this that will make them pass over us like a predator mistaking potential food for non-nutritious dead vegetation."

  • JB (unregistered) in reply to Jaybles
    Jaybles:
    DOA:
    I think the only solution is to wire pepper spray to certain people's keyboards and have it activate when Ctrl + C is pressed.

    They would simply learn to copy/paste using context menus. You know, assuming the didn't go blind from the first couple sprays.

    Oh, that ctl-c...I'd wondered why y'all were wanting to spray them for force-killing a foreground job...

  • Alex (unregistered) in reply to Zylon

    To be fair, I once worked with a chap who solely used the Edit->Copy/Edit->Replace mouse-only method of C&P. It was kind of surreal watching him work, because he used it pretty much exclusively. You'd end up with one of those cobbled together applications that happens to send welcome emails (per the original requirement), and also do pretty much anything else you'd ever want it to in the other few thousand lines.

  • Alex (unregistered) in reply to Zylon
    Zylon:
    Jaybles:
    DOA:
    I think the only solution is to wire pepper spray to certain people's keyboards and have it activate when Ctrl + C is pressed.

    They would simply learn to copy/paste using context menus. You know, assuming the didn't go blind from the first couple sprays.

    Think about the sort of people we're dealing with here. The copy/paste buttons are probably the only way they know how to do it.

    Sorry- my last post was in response to this. I suck at forums.

  • (cs)
    but it does serve other purposes.

    It serves as a warning to others.

  • anonymous (unregistered) in reply to wtf

    [quote user="wtf"] ++1[/quote]

    Damn you, now 1==2 and math's all screwed up. Someone call Russell and Whitehead in, we need to reboot.[/quote]

    You're an idiot.

    If anything, that's going to increment the value at memory location 1... not the value of one.

    int* i = 1; ++*i;

  • tovarich (unregistered) in reply to wtf
    wtf:
    DOA:
    I think the only solution is to wire pepper spray to certain people's keyboards and have it activate when Ctrl + C is pressed.

    I don't get it. Why would you want to mace someone for cancelling a job?

    They could be using Mono, but for some reason I doubt the person(s) responsible for that code works on a *nix system.
  • Bryan the K (unregistered) in reply to Doodle
    Doodle:
    Markus:
    apaq11:
    I don't even see &, | or () anymore. All I see is brunette, redhead...

    +1 :D

    ++1

    C-C-C-C-Combo BREAKER

  • wtf (unregistered) in reply to anonymous
    anonymous:

    You're an idiot.

    If anything, that's going to increment the value at memory location 1... not the value of one.

    int* i = 1; ++*i;

    Wow, someone got up on the stupid side of the bed this morning.

  • (cs) in reply to Guru
    Guru:
    2) When encountering an if-ten statement that you don't necessarily understand, it is your duty as a programmer to add more &&s and ||s until it meets the needs of your particular bug fix (f*** testing the other, existing requirements)
    This isn't even close to an if-ten, it's an if-seven at most.
  • (cs) in reply to Hasteur
    Hasteur:
    a big differently?

    Alex, hand over your English mastery card, I need to take a corner off it.

    Clearly, your sense of linguistic sarcasm never developed.

  • (cs)

    WTF (Why TF not so much as What TF) would anyone apply full text justification to code?

  • BlueCollarAstronaut (unregistered) in reply to Skilldrick
    Skilldrick:
    Skilldrick:
    TRWTF is using spaces instead of tabs.

    Of course, I meant "using tabs instead of spaces". :P

    So, TRWTF is using tabs instead of spaces as well as both using "spaces" instead of "tabs" and "tabs" instead of "spaces"? This is becoming paradoxical...

  • airdrik (unregistered)

    fixed?

    String parentField = sub.getParentField().toLowerCase();
    String fieldName = sub.getFieldName().toLowerCase();
    if (params.containsKey(parentField) && params.containsKey(fieldName))
    {
    	String parentFieldValue = params.get(parentField).getValue();
    	String fieldNameValue = params.get(fieldName).getValue();
    	if (parentFieldValue.equalsIgnoreCase(sub.getReplaceOn()) || 
    		 (
    			"*".equals(sub.getReplaceOn()) && 
    			fieldNameValue != null && 
    			! fieldNameValue.trim().isEmpty()
    		)
    	)
    	{
    
  • Anon (unregistered)

    For readability:

    if (
    	params.containsKey(sub.getParentField().toLowerCase()) 
    	&& (
    		params.get(sub.getParentField().toLowerCase()).getValue().equalsIgnoreCase(sub.getReplaceOn()) 
    		|| (
    			"*".equalsIgnoreCase(sub.getReplaceOn()) 
    			&& params.get(sub.getFieldName().toLowerCase()) != null 
    			&& params.get(sub.getFieldName().toLowerCase()).getValue() != null 
    			&& !"".equals(params.get(sub.getFieldName().toLowerCase()).getValue().trim())
    		)
    	)
    	&& params.containsKey(sub.getFieldName().toLowerCase())
    ) {

    Forgive my ignorance, but does the !"".equals() actually do anything useful?

  • Olius (unregistered) in reply to TheSHEEEP

    No, this is SPARTAAAAAAAAAAAAA!

  • Olius (unregistered) in reply to anonymous
    anonymous:
    ih8u:

    It's not really a mastery of English problem. It's a reading-what-i-just-wrote problem. Spell check doesn't catch errors if the errors are legitimate words.

    I no I always check every thing that I wrote online to made sure that it is well wrote.

    To all who would post a thing online:

    Just take the time to read a post as though you were reading it for the first time. It's hard to find the extra minute or so, but it sure saves WTF readers a LOT of crying and wet pants.

    I hope you're kidding. I no there is no way you took the time when posting a thing.

    I love this board. So much understanding of humour, irony, and any small mistakes are completely overlooked. No one here would ever try to argue with each other to prove they are more correct that everyone else.

    It is truly the oasis in the middle of an Aspergers desert.

  • airdrik (unregistered) in reply to BlueCollarAstronaut
    BlueCollarAstronaut:
    Skilldrick:
    Skilldrick:
    TRWTF is using spaces instead of tabs.

    Of course, I meant "using tabs instead of spaces". :P

    So, TRWTF is using tabs instead of spaces as well as both using "spaces" instead of "tabs" and "tabs" instead of "spaces"? This is becoming paradoxical...

    TRWTF is using spaces (http://www.retas.de/thomas/computer/programs/useless/misc/game_of_life/index.html).

  • Anonymous (unregistered) in reply to DOA
    DOA:
    I think the only solution is to wire pepper spray to certain people's keyboards and have it activate when Ctrl + C is pressed.
    Thanks a lot, I just terminated a batch file and now I'm blind.
  • (cs)

    So... requirements are:

    1. The parent field must be non-null.
    2. The field name must be non-null.
    3. (The replace field must be an asterix and the field Name must not be blank) or (the replace field must have the same value as the parent field).

    It's pretty clear that they messed up the code, and after a quick look it is equally clear that they messed up the requirements.

    I do however appreciate the use of 'equalsIgnoreCase' just in case the 'toLowerCase' fails.

  • (cs) in reply to Olius
    Olius:
    I love this board. So much understanding of humour, irony, and any small mistakes are completely overlooked. No one here would ever try to argue with each other to prove they are more correct that everyone else.

    It is truly the oasis in the middle of an Aspergers desert.

    Ohithere! You must be the new guy...

  • Bruce W (unregistered) in reply to Guru
    Guru:
    This illustrates two of the fundamental axioms of development:
    1. Given a piece of code, there must necessarily exist a more obfuscated and less readable way to write the same functionality

    2. When encountering an if-ten statement that you don't necessarily understand, it is your duty as a programmer to add more &&s and ||s until it meets the needs of your particular bug fix (f*** testing the other, existing requirements)

    Thank you for these rules. I have printed them out and taped them to my cube. I promise to follow them until I die or until one of my coworkers wires pepper spray to my keyboard.

  • Anonymous (unregistered) in reply to Anon
    Anon:
    For readability:
    if (
    	params.containsKey(sub.getParentField().toLowerCase()) 
    	&& (
    		params.get(sub.getParentField().toLowerCase()).getValue().equalsIgnoreCase(sub.getReplaceOn()) 
    		|| (
    			"*".equalsIgnoreCase(sub.getReplaceOn()) 
    			&& params.get(sub.getFieldName().toLowerCase()) != null 
    			&& params.get(sub.getFieldName().toLowerCase()).getValue() != null 
    			&& !"".equals(params.get(sub.getFieldName().toLowerCase()).getValue().trim())
    		)
    	)
    	&& params.containsKey(sub.getFieldName().toLowerCase())
    ) {

    Forgive my ignorance, but does the !"".equals() actually do anything useful?

    It will return "false" if the parameter passed into equals() is not an empty string. This is the retarded equivalent of doing ((param != null) && !param.equals("")). They've done !"".equals(param) because this means they don't have to null-check the parameter (instead they are calling equals on a new empty string and passing the param into that, so it doesn't matter if param is null).

  • Bruce W (unregistered) in reply to Olius
    Olius:
    I love this board. So much understanding of humour, irony, and any small mistakes are completely overlooked. No one here would ever try to argue with each other to prove they are more correct that everyone else.

    It is truly the oasis in the middle of an Aspergers desert.

    That is why I will make my Aspy son read TDWTF as an example of how adults communicate. Nothing like positive reinforcement.

  • Billy The Squid (unregistered) in reply to DOA
    DOA:
    I think the only solution is to wire pepper spray to certain people's keyboards and have it activate when Ctrl + C is pressed.

    What of Shift+Delete / Control+Insert / Shift+Insert? Flying puppies that shit green M&M's fly from the wall to deliver gifts of canned walrus meat?

  • wtf (unregistered) in reply to Billy The Squid
    Billy The Squid:
    DOA:
    I think the only solution is to wire pepper spray to certain people's keyboards and have it activate when Ctrl + C is pressed.

    What of Shift+Delete / Control+Insert / Shift+Insert? Flying puppies that shit green M&M's fly from the wall to deliver gifts of canned walrus meat?

    Want that.

  • Rosuav (unregistered)

    "*".equalsIgnoreCase(sub.getReplaceOn())

    This right here is an argument in favour of short function names like strcmp/stricmp. It wouldn't look so ridiculous if the superfluous 'do this check case insensitively' added only a single character to the line, although it's still superfluous in run-time cost (probably not an issue here as it seems to be in response to UI action). But seriously dude, didn't your mother ever tell you about temporary variables?

Leave a comment on “The Other If”

Log In or post as a guest

Replying to comment #:

« Return to Article