Comment On The Clever Coder

Jan's coworker had come to be known around the office as The Clever Coder. Not quite the clever we've come to expect on The Daily WTF, but more the unfunny-uncle-who-thinks-he's-funny sort of clever. [expand full text]
« PrevPage 1 | Page 2 | Page 3 | Page 4Next »

Re: The Clever Coder

2009-10-07 10:21 • by Anonymous (unregistered)
Oh god why

Re: The Clever Coder

2009-10-07 10:24 • by Steve (unregistered)
!clever

Re: The Clever Coder

2009-10-07 10:25 • by Anon (unregistered)
trueandorfalse?
WTF #1 is not knowing the ! operator.
WTF #2 is not knowing that the logical operation you are doing is called "not".
WTF #3 is not handling FILE_NOT_FOUND.

Re: The Clever Coder

2009-10-07 10:26 • by Anonymous (unregistered)
Why is it called trueandorfalse() ?

Re: The Clever Coder

2009-10-07 10:29 • by eViLegion (unregistered)
287160 in reply to 287158
Anonymous:
Why is it called trueandorfalse() ?

Because you can put True &/ False in as the input, and you'll get True &/ False as the output, presumably.

This is one of the best things I've ever seen.

Re: The Clever Coder

2009-10-07 10:31 • by Ben (unregistered)
A real coder would have done:

return xor(_booInpt,1);

Obvious really...

Re: The Clever Coder

2009-10-07 10:31 • by SurfMan (unregistered)
At least it's well documented, and even has a touch of humor (Scientology wtf?)

Re: The Clever Coder

2009-10-07 10:33 • by RayMarron
This comment is clever... NOT!

Re: The Clever Coder

2009-10-07 10:33 • by highphilosopher (unregistered)
reminds me of a

if((!shouldContinue) == false)
{

// blah....


}

I saw one time. Suddenly the death penalty seems sort of reasonable in extreme situations.

Re: The Clever Coder

2009-10-07 10:35 • by T $
The fool! He needs another if!

/// <summary>
/// Turns true into false and false into true
/// -- similar to the church of scientology.
/// <param name="_booInpt">True of false</param>
/// <returns>False or true</returns>
private bool trueandorfalse(bool _booInpt)
{
// I'm quite sure though there is a very
// clever C# standard command doing this,
// I just can't find it right now ...
if (_booInpt == true)
return false;
if (_booInpt == false)
return true;
}

Looks like I caught this one just in time! :)

Re: The Clever Coder

2009-10-07 10:37 • by Lisa McPherson (unregistered)
287167 in reply to 287157
WTF:
/// -- similar to the church of scientology.

The Church of Scientology is a very dangerous organization.

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

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

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

Be very careful how you decide to engage them.

Re: The Clever Coder

2009-10-07 10:37 • by flyboyfred (unregistered)
287168 in reply to 287156
Steve:
!clever


I think you mean, "trueandorfalse(clever)".

Re: The Clever Coder

2009-10-07 10:39 • by D (unregistered)
287169 in reply to 287166
T $:
The fool! He needs another if!

/// <summary>
/// Turns true into false and false into true
/// -- similar to the church of scientology.
/// <param name="_booInpt">True of false</param>
/// <returns>False or true</returns>
private bool trueandorfalse(bool _booInpt)
{
// I'm quite sure though there is a very
// clever C# standard command doing this,
// I just can't find it right now ...
if (_booInpt == true)
return false;
if (_booInpt == false)
return true;
}

Looks like I caught this one just in time! :)


LMAO
greatest comment ever

Re: The Clever Coder

2009-10-07 10:43 • by Buddy (unregistered)
// converts true to false and false to true

// extra ! are to make sure it's absolutely, positively,
// unambiguously, categorically, unconditionally, decidedly,
// unquestionably and definitely inverted
bool invert(bool b)
{
return !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!b;
}

Extra credit to those who actually counted!

Re: The Clever Coder

2009-10-07 10:45 • by C4I_Officer
What about FILE_NOT_FOUND?

Re: The Clever Coder

2009-10-07 10:47 • by db2
This suit is black not.

Re: The Clever Coder

2009-10-07 10:47 • by OutlawProgrammer (unregistered)
TRWTF is Microsoft thinking that using XML for comments was a good idea.

Re: The Clever Coder

2009-10-07 10:48 • by akatherder
287174 in reply to 287166
T $:
The fool! He needs another if!

Looks like I caught this one just in time! :)


What if the boolean isn't true or false though?


/// <summary>
/// Turns true into false and false into true
/// -- similar to the church of scientology.
/// <param name="_booInpt">True of false</param>
/// <returns>False or true</returns>
private bool trueandorfalse(bool _booInpt)
{
// I'm quite sure though there is a very
// clever C# standard command doing this,
// I just can't find it right now ...
if (_booInpt == true)
return false;
if (_booInpt == false)
return true;
return FILE_FOUND_SEVERAL_TIMES
}

Re: The Clever Coder

2009-10-07 10:50 • by SarahE
287176 in reply to 287170
Buddy:
// converts true to false and false to true

// extra ! are to make sure it's absolutely, positively,
// unambiguously, categorically, unconditionally, decidedly,
// unquestionably and definitely inverted
bool invert(bool b)
{
return !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!b;
}

Extra credit to those who actually counted!


Thank goodness someone knows that you have to make sure the computer really gets it. But just to make sure, you should return it again, in case the computer missed the return statement the first time.

:)

Also... 47. Extra credit

Re: The Clever Coder

2009-10-07 11:01 • by KD (unregistered)
The real WTF is when a decent compiler doesn't turn this method call into a simple ! operation.

Re: The Clever Coder

2009-10-07 11:04 • by Shredder (unregistered)
XML is a good idea for EVERYTHING.

Re: The Clever Coder

2009-10-07 11:06 • by Rodnas (unregistered)
287179 in reply to 287172
db2:
This suit is black not.


It is great joke. I like. Tjenkoeje.

Re: The Clever Coder

2009-10-07 11:08 • by NightDweller
trueandorfalse(its) only that the coder trueandorfalse(does) know the basic operands, but he also feels he trueandorfalse(could) be bothered to look for them at the moment.

but he is somehow capable of endless trueandorfalse(wit) in his comments.

Re: The Clever Coder

2009-10-07 11:15 • by Markp
Countdown to Alex being sued, murdered, or falsely discredited for being a sexual deviant:

10:01:59...
10:01:58...
10:01:57...
10:01:56...

Re: The Clever Coder

2009-10-07 11:16 • by RHuckster
The lawyers at the Church of Scientology have been notified and will sue the pants off of Alex, the original author of this posting, and the original author of the code.

Addendum (2009-10-07 11:21):
The lawyers at the Church of Scientology have been notified and will sue the pants off of Alex, the original author of this posting, and the original author of the code. Katie Holmes will represent the church in court and will appoint Tom Cruise as the judge. If you accuse them of bias by attempting to appoint a fellow follower as the judge, they shall sue you a second time.

Re: The Clever Coder

2009-10-07 11:16 • by Wheaties (unregistered)
287183 in reply to 287180
I've seen this before unfortunately. Only it's been 1 to 0 and 0 to 1 instead of using the built in boolean of the language.

Re: The Clever Coder

2009-10-07 11:19 • by trueandorfalse(nobody) (unregistered)
287184 in reply to 287180
NightDweller:
trueandorfalse(its) only that the coder trueandorfalse(does) know the basic operands, but he also feels he trueandorfalse(could) be bothered to look for them at the moment.

but he is somehow capable of endless trueandorfalse(wit) in his comments.
Maybe he DID look for some built-in operator for the "andor" operation, but didn't find anything...

Re: The Clever Coder

2009-10-07 11:20 • by TarquinWJ
What is the "true of false"? Is there truth in falsehood?

Re: The Clever Coder

2009-10-07 11:21 • by Tom Cruise (unregistered)
287186 in reply to 287163
SurfMan:
At least it's well documented, and even has a touch of humor (Scientology wtf?)
I'm a Scientologist, you insensitive clod!

Re: The Clever Coder

2009-10-07 11:24 • by Zylon
287187 in reply to 287183
Wheaties:
I've seen this before unfortunately. Only it's been 1 to 0 and 0 to 1 instead of using the built in boolean of the language.

And even then, trivial to invert with "value = 1 - value". You used to see that a lot in old BASIC programs.

Re: The Clever Coder

2009-10-07 11:24 • by lawlsci (unregistered)
287188 in reply to 287186
Tom Cruise:
SurfMan:
At least it's well documented, and even has a touch of humor (Scientology wtf?)
I'm a Scientologist, you insensitive clod!


Calm down, don't go all Sci-Fi on him!

Re: The Clever Coder

2009-10-07 11:29 • by Galvanick Lucipher (unregistered)
GREATEST. WTF. EVER.

Re: The Clever Coder

2009-10-07 11:30 • by !? (unregistered)
287190 in reply to 287162
Ben:
A real coder would have done:

return xor(_booInpt,1);

Obvious really...

!!!

Re: The Clever Coder

2009-10-07 11:32 • by Anon (unregistered)
287191 in reply to 287180
NightDweller:
trueandorfalse(its) only that the coder trueandorfalse(does) know the basic operands, but he also feels he trueandorfalse(could) be bothered to look for them at the moment.

but he is somehow capable of endless trueandorfalse(wit) in his comments.



You fail on your last use of trueandorfalse.

wit not? not wit? trueandorfalse(does) make sense.

Re: The Clever Coder

2009-10-07 11:32 • by derula
287192 in reply to 287176
SarahE:
But just to make sure, you should return it again, in case the computer missed the return statement the first time.


Like this?

bool invert(bool b)

{
while (true)
{
return !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!b;
}
}


Now, about the halting problem...

Re: The Clever Coder

2009-10-07 11:33 • by silent d (unregistered)
287193 in reply to 287188
From now on, I'm outsourcing all my development work to the Church of Scientology. I mean, at least they admit their Book was written by a science fiction author.

Re: The Clever Coder

2009-10-07 11:33 • by Daid
highphilosopher:
reminds me of a

if((!shouldContinue) == false)
{

// blah....


}

I saw one time. Suddenly the death penalty seems sort of reasonable in extreme situations.
I have seen worse:

if((!notShouldContinue) == false)

Good luck.

Re: The Clever Coder

2009-10-07 11:35 • by !? (unregistered)
287195 in reply to 287166
T $:
The fool! He needs another if!

/// <summary>
/// Turns true into false and false into true
/// -- similar to the church of scientology.
/// <param name="_booInpt">True of false</param>
/// <returns>False or true</returns>
private bool trueandorfalse(bool _booInpt)
{
// I'm quite sure though there is a very
// clever C# standard command doing this,
// I just can't find it right now ...
if (_booInpt == true)
return false;
if (_booInpt == false)
return true;
}

Looks like I caught this one just in time! :)

I hope you are joking.

... couldn't resist. CAPTCHA: secundum.
!primum

Re: The Clever Coder

2009-10-07 11:37 • by xtremezone
287196 in reply to 287156
Steve:
!clever
QFT.

Fired.

Re: The Clever Coder

2009-10-07 11:45 • by The Sussman (unregistered)
FRIST

Re: The Clever Coder

2009-10-07 11:45 • by hajo (unregistered)
I'm quite sure there is a very clever post commenting this, I just can't find it right now ...

Re: The Clever Coder

2009-10-07 11:50 • by NightDweller
287200 in reply to 287191
Anon:
NightDweller:
trueandorfalse(its) only that the coder trueandorfalse(does) know the basic operands, but he also feels he trueandorfalse(could) be bothered to look for them at the moment.

but he is somehow capable of endless trueandorfalse(wit) in his comments.



You fail on your last use of trueandorfalse.

wit not? not wit? trueandorfalse(does) make sense.


That one was intended as a "...endless wit (not!) .." sort of thing.

Re: The Clever Coder

2009-10-07 11:52 • by NotNotWhat (unregistered)
287201 in reply to 287192
derula:
SarahE:
But just to make sure, you should return it again, in case the computer missed the return statement the first time.


Naaa, I think like this:

bool invert(bool b)

{
while ( invert(false) )
{
return !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!b;
}
}


Now, about the halting problem...

Re: The Clever Coder

2009-10-07 11:55 • by ClutchDude (unregistered)
The googles....they do nothing!


Captcha: plaga... like the RE:4&5 plot device.

Re: The Clever Coder

2009-10-07 11:55 • by martiert (unregistered)
287203 in reply to 287166
Yeah. Only problem is that the compiler won't like this since you use an if instead of an else. So it might get to the end of the function without returning anything. Solution: throw an exception!

Re: The Clever Coder

2009-10-07 11:57 • by C (unregistered)
287204 in reply to 287195
!?:
T $:
The fool! He needs another if!

(code snipped)

Looks like I caught this one just in time! :)

I hope you are joking.

... couldn't resist. CAPTCHA: secundum.
!primum
Of course he is. That code wouldn't even compile, the stupid compiler complains that not all code paths return a value... 8-|

Re: The Clever Coder

2009-10-07 12:08 • by Jay (unregistered)
I have frequently seen code that is clearing trying to initialize a flag that looks like this:

if (flag==true)
flag=false;

I've seen this from multiple programmers at different companies, like they must either teach this in school somewhere or it's a common form of mental illness. What, you think that it will take the computer longer to set the flag to false when it's already false then it would to first check if it's true? Actually the reverse is almost certainly the case. Or are you just being careful not to set it to false when it's currently FILE_NOT_FOUND?

Ditto on:

if (amount1!=0)
total=total+amount1;

Yeah, we want to save the computer from having to add the two numbers together if one of them is zero. Except, the "if" almost surely takes longer than the plus, so if it's not zero, the "if" is completely superfluous wasted time, and if it is zero, you've still taken longer than just adding it in.

Re: The Clever Coder

2009-10-07 12:12 • by grg (unregistered)
Well, actually, it DOES do something more than the NOT operator (!) does.

It maps values that are EXACTLY equal to "true" to false,
everything else maps to true.

If we assume that the incoming value might have come from an unsafe source, and might contain any random value, then it does do something slightly different than (!)

Not that that makes it any better.

Re: The Clever Coder

2009-10-07 12:13 • by nitehawk (unregistered)
If it wasnt for the amusing "similar to the church of scientology" text, I would fire this person on the spot.

Re: The Clever Coder

2009-10-07 12:19 • by Neo31337 (unregistered)
287210 in reply to 287165
highphilosopher:
reminds me of a

if((!shouldContinue) == false)
{

// blah....


}

I saw one time. Suddenly the death penalty seems sort of reasonable in extreme situations.


LOL! I haven't laughed this hard in a long time.
« PrevPage 1 | Page 2 | Page 3 | Page 4Next »

Add Comment