• Design Pattern (unregistered)

    ********* NEWSFLASH ************ Little Bobby T. now obtained a drivers license! see his car! ********* NEWSFLASH ************

  • (cs)

    The thing is... not everybody is a gifted developer, and certainly very few people are as gifted as I am.

    But there's such a thing as common sense. You know, a council that collects rubbish only once a fortnight, and then fines citizens because their wheelie bins are too full, that's not having common sense. (And therefore, it happens all the time in the United Kingdom.)

    But some people just don't have that 'common sense'. This reminds me of a developer who used to work with us, who was tasked to integrate two (fairly complex) systems that I wrote.

    He had some problem, asked me to help him, which I did, after which I watched him type in code that was all wrong, and showed that whatever I told him got somehow sidetracked along the way and did not reach 'go' in his brain, and most certainly did not collect $200.

    The systems have never really recovered from it.

  • luser (unregistered)

    IntelliJ IDEA can inline such methods with a single command. It will even remove the old method, so such cleanup is a breeze. /beentheredonethat

  • Nick J (unregistered)

    One of my pet hates is this:

    boolean myvar = false; if (someBooleanExpression) { myvar = true; } return myvar;

    instead of:

    return someBooleanExpression;

  • My Name? (unregistered)

    #include<math.h> char* is_zero(const int& n) { const int max=32; char str[max]; for(int i=0;i<max;++i) str[i]=0x30+((n/int(pow(10,max-1-i)))%10); for(int i=0;i<max;++i) if(str[i]>='1' && str[i]<='9') return "red"; return "is zero"; }

  • Brent (unregistered) in reply to Sanity
    Sanity:
    And yet... isNull(x) == isNotNull(x). That can't be good.

    Hey! isNotNull has a null statement in the if block for "timing".

  • Anon (unregistered)

    Oh man, you found my utility package! I was looking all over for that!

    Does it still have ReturnLengthOfString(string input) and ReturnCountOfCollection(ICollection collection)?

  • Bim Job (unregistered) in reply to dkf
    dkf:
    KimmoS:
    The Tao master once explained the nature of x to a young student.

    "Is x Null?" asked the Student.

    "Is x not Null?" asked the Master in turn.

    The Student was enlightened.

    Mu!

    Null is the value that is not a value. To ask what it's value nature is is to deny its Null nature, and yet it is a value nonetheless. Compare with NaN in IEEE floating point.

    I could swear I've seen -NaN at some point. I suspect it was a confusion between quiet NaN and signalling NaN.

    If a Nan signals when nobody is around to hear it, does it become quiet?

    From an aesthetic standpoint, I think they sacked the guy too early. I'd really like to see his implementation of

    public static boolean isNaN (String val)
    Or
    public static boolean isNotANaN (String val)

    Also, somebody sooner or later is going to mention that the captcha is "damnum." Indeed.

  • SAMO (unregistered)

    CAPTCHA: intenteger

  • Murdog (unregistered) in reply to toth
    toth:
    I don't see the WTF. As far as I can see, this developer is ahead of all of us. Who among us could write a method that checks not the integer that we pass in, but the integer that we intended to pass in? This is an ESP library. I'm in awe.

    Yes, an Extremely Sh**ty Programmer Library... yes, i do believe it is!

  • Morgoth (unregistered) in reply to luser
    luser:
    Any IDE with half-decent refactoring tools can inline such methods with a single command. It will even remove the old method, so such cleanup is a breeze. /beentheredonethat

    There. Fixed it.

    TRWTF here is that the department as a whole seemed to have a "Well, it works so who cares?" attitude. Any old code review would have thrown up warnings about this, and maybe, just maybe, someone could have had a word in the guy's ear about uselessness and what-not.

  • My Name? (unregistered)

    int is_null(char* s) { s=NULL; // make sure s is null. if(s!=NULL) // check if s is really null! { printf("Your computer has got bad memories, better go and buy a new one."); return !1; } return 1; // bene }

  • Anomynous Coward (unregistered)

    "I know how to spell integer, but I don't know where to stop."

    if (isNull("null") == isNotNull("null")) 
    {
       printf("<font color="%s">WTF</color>", isEmpty("", "WTF"));
    }
  • Jay (unregistered)

    According to Wikipedia, an "intenteger" is a string that you intend to be parsed as an integer.

    http://en.wikipedia.org/wiki/Intenteger

  • Alfredo (unregistered)

    I really like the isEmpty function. Two parameters, returns the hex for color red... Is just so random!

  • Bim Job (unregistered) in reply to Alfredo
    Alfredo:
    I really like the isEmpty function. Two parameters, returns the hex for color red... Is just so random!
    Let's just get one thing straight, here.

    OK, two things. Are you seriously suggesting that there's something random about having two parameters?

    Anyway, the other thing. This is not "the hex for color red." I've checked with my local Wicca expert, and she definitely recommends a garlic bulb with a pin in each clove.

    It's not even "the RGB representation for the color red." There are at least four of the fuckers, and I'm not even counting "the RGB representation for the color red for somebody who is red-green color-blind."

    It's digital 8-bit, and as such you have to wonder why the piss-artist in question picked it.

    Presumably because the function in question was used to highlight a failure in red ... gosh, who'da thunk?

    In terms of a "utility" this has a very limited utility, but that's not a surprise. It's a hell of a lot less of a WTF that pratting on about your l33t knowledge of the most common form of RGB encoding.

  • Paula (unregistered)

    function isBrillant() return "Hells Yeahs!";

  • @Deprecated (unregistered)

    These utilities rock!

    I can haz rest of c0des?

    if (isNull(x) && isNotNull(x)) { setMyFace(isEmpty(""," ")); }

  • IV (unregistered)

    "The OTHER 24 methods weren't much better."

    That was the part of the article that made me wonder. If you have 24 methods and display 3, how do you have 24 others? I tend to think this developer did a good job to leave a company where the other devlopers have such poor math skills.

  • Ike (unregistered) in reply to sjakie
    sjakie:
    Oh sorry, must have misread that.

    Never liked the ent framework, reminds me too much of Hobbit++ not to mention ring buffers and ELF-Eventhandling.

    Don't forget the elf-documenting code.

  • (cs) in reply to IV
    IV:
    "The OTHER 24 methods weren't much better."

    That was the part of the article that made me wonder. If you have 24 methods and display 3, how do you have 24 others? I tend to think this developer did a good job to leave a company where the other devlopers have such poor math skills.

    The three displayed are NULL and not counted in the SUM

  • Franz Kafka (unregistered) in reply to Anonymous
    Anonymous:
    This sort of code is like a recurring nightmare. I can't even count the number of times I've seen this crap before and it's a foregone conclusion that I'll see it again. Note to HR: stop hiring these people FFS! You are the reason we must suffer these fools!

    HR doesn't make the hire decision (unless he has a felony he forgot to mention) - it's your coworkers that can't screen out bad candidates.

  • (cs) in reply to sjakie
    sjakie:
    spxza:
    It's not an additional "nte" it's an additional "ent", made to work on trees.

    Oh sorry, must have misread that.

    Never liked the ent framework, reminds me too much of Hobbit++ not to mention ring buffers and ELF-Eventhandling.

    It fell from favour because it was never possible to get certified. The examiners just always said. "You cannot pass!"

  • Gandalf (unregistered) in reply to Ike

    Do not go to the elves for advice, for they will tell you both isNull(x) and isNotNull(x). Never mind, that works here!

    --G

  • bored (unregistered) in reply to You didn't see me right
    You didn't see me right:
    Thank you dailywtf for confirming once again that whatever happens, I'll never write code as bad as an isEmpty function that returns either an empty string or the hex code for red. Thank you for reaffirming my belief in myself.

    I completely agree, however I know that one day I may see some of my code on here, my only hope is that it is not the code I have written within the last couple years.

  • Ben (unregistered)

    How on earth did you get your hands on the source code of Windows ME?

  • Gaspar (unregistered) in reply to Coyne

    Your missing a ")" on the e.isRetarded() line.

    CAPTCHA Eros... not so much, no.

  • Just Wondering... (unregistered) in reply to Severity One
    Severity One:
    The thing is... not everybody is a gifted developer, and certainly very few people are as gifted as I am.

    But there's such a thing as common sense. You know, a council that collects rubbish only once a fortnight, and then fines citizens because their wheelie bins are too full, that's not having common sense. (And therefore, it happens all the time in the United Kingdom.)

    But some people just don't have that 'common sense'. This reminds me of a developer who used to work with us, who was tasked to integrate two (fairly complex) systems that I wrote.

    He had some problem, asked me to help him, which I did, after which I watched him type in code that was all wrong, and showed that whatever I told him got somehow sidetracked along the way and did not reach 'go' in his brain, and most certainly did not collect $200.

    The systems have never really recovered from it.

    Do you masturbate in front of your self portrait?

  • (cs) in reply to KimmoS
    The Tao master once explained the nature of x to a young student.

    "Is x Null?" asked the Student.

    "Is x not Null?" asked the Master in turn.

    The Student was enlightened.

    I just laughed out loud in real life.

  • INTERCAL (unregistered) in reply to Anomynous Coward
    Anomynous Coward:
    "I know how to spell integer, but I don't know where to stop."
    if (isNull("null") == isNotNull("null")) 
    {
       printf("<font color="%s">WTF</color>", isEmpty("", "WTF"));
    }

    That won't compile. You missed the escape sequences inside the printf() format string.

  • Laughing Jack (unregistered) in reply to Just Wondering...
    Just Wondering...:
    Severity One:
    The thing is... not everybody is a gifted developer, and certainly very few people are as gifted as I am.

    But there's such a thing as common sense. You know, a council that collects rubbish only once a fortnight, and then fines citizens because their wheelie bins are too full, that's not having common sense. (And therefore, it happens all the time in the United Kingdom.)

    But some people just don't have that 'common sense'. This reminds me of a developer who used to work with us, who was tasked to integrate two (fairly complex) systems that I wrote.

    He had some problem, asked me to help him, which I did, after which I watched him type in code that was all wrong, and showed that whatever I told him got somehow sidetracked along the way and did not reach 'go' in his brain, and most certainly did not collect $200.

    The systems have never really recovered from it.

    Do you masturbate in front of your self portrait?
    I don't know about him, but I certainly do!

  • Chris (unregistered) in reply to Bobble

    Hangover? It's still drunk!

  • Daryl (unregistered)

    Looks like functional programming gone really bad.

    Also a very bad case of not understanding decoupling concepts. My guess is it was meant to have been used as such

    textfield.backgroundColor = isEmpty(textfield.value);
    

    I can't explain away the intenteger though. Possibly typo + IDE autocomplete + lack of documentation.

  • Daryl (unregistered)

    Looks like functional programming gone really bad.

    Also a very bad case of not understanding decoupling concepts. My guess is it was meant to have been used as such

    textfield.backgroundColor = isEmpty(textfield.value);
    

    I can't explain away the intenteger though. Possibly typo + IDE autocomplete + lack of documentation.

  • Bottoms (unregistered) in reply to spxza

    Exactly. It makes me wonder how many retarded developers we have reading and commenting on these stories. Quite clearly none of them can read. I'd like to see their code that doesn't comform to spec. You read and speaka teh gud engrish, ja!?

  • Yo SUB (unregistered)

    Nothing wrong with thinking outside the box.

    I want to live in a world where NULL != NULL(;).

  • Herby (unregistered) in reply to Ben
    Ben:
    How on earth did you get your hands on the source code of Windows ME?
    It wasn't Windows Me, it was Windows Vista (current century)
  • (cs) in reply to Just Wondering...
    Just Wondering...:
    Severity One:
    The thing is... not everybody is a gifted developer, and certainly very few people are as gifted as I am.
    Do you masturbate in front of your self portrait?
    I don't need to. Plenty of others are already doing just that.
  • sjakie (unregistered) in reply to Ben
    Ben:
    How on earth did you get your hands on the source code of Windows ME?

    Windows Middle Earth?

    Damn those trolls....

    CAPTCHA: Nobis, one of Frodo's buddies?

  • Christoph S. (unregistered) in reply to KimmoS
    KimmoS:
    The Tao master once explained the nature of x to a young student.

    "Is x Null?" asked the Student.

    "Is x not Null?" asked the Master in turn.

    The Student was enlightened.

    Good one! This really made me laugh.

    Captcha: nimis Latin for "too much"

  • Anonymous (unregistered) in reply to Franz Kafka
    Franz Kafka:
    Anonymous:
    This sort of code is like a recurring nightmare. I can't even count the number of times I've seen this crap before and it's a foregone conclusion that I'll see it again. Note to HR: stop hiring these people FFS! You are the reason we must suffer these fools!
    HR doesn't make the hire decision (unless he has a felony he forgot to mention) - it's your coworkers that can't screen out bad candidates.
    You've never met our HR manager. Round here, developers can question a potential hire but HR has the final word. If the devs like a candiate and HR doesn't they don't get hired. If HR likes a candidate and the devs say he's useless, he gets hired anyway. This is so common in our office that I suspect it may be an official procedure to avoid decent candidates.
  • Jo (unregistered) in reply to Severity One
    Severity One:
    Just Wondering...:
    Severity One:
    The thing is... not everybody is a gifted developer, and certainly very few people are as gifted as I am.
    Do you masturbate in front of your self portrait?
    I don't need to. Plenty of others are already doing just that.
    Yeah... in 'a beautiful mind' kinda way! How are all those 'others' doing?
  • NJ (unregistered)

    "I opened the package and found a single class with 24 methods filled with sad code." [...] Scott continues, "those were the 1st, 2nd, and 3rd methods in the utility class. The other 24 methods weren't much better."

    Now, how many mehtods were there again?

  • Fred (unregistered) in reply to NJ
    NJ:
    "I opened the package and found a single class with 24 methods filled with sad code." [...] Scott continues, "those were the 1st, 2nd, and 3rd methods in the utility class. The other 24 methods weren't much better."

    Now, how many mehtods were there again?

    Well spotted!

  • Alex (unregistered)

    No amount of education can cure that shitty programmer. A real WTF!

  • Mike5 (unregistered)

    I'm almost afraid to ask, but:

    public static boolean isIntegerInRange(String integer, int min, int max)
    

    ...why is "integer" String?

    Mike5

  • Yanman (unregistered)

    I like my women to be like my code. 12 years old and undocumented.

  • NutDriverLefty (unregistered) in reply to Yanman
    Yanman:
    I like my women to be like my code. 12 years old and undocumented.

    See, "Mexicali Blues" by the Grateful Dead. :-)

  • highphilosopher (unregistered)

    Come on, everyone knows that self commented code sometimes leads to issues, but at least you can tell what the programmers INTENTeger was when writing this code.

  • Hobo (unregistered) in reply to Jay

    Damn, I got rickrolled.

Leave a comment on “The Utility Package ”

Log In or post as a guest

Replying to comment #:

« Return to Article