- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
IFRisTP0zTer();
Admin
Wow. That is insane.
Admin
I love it. And you know if he came across you checking >=1 in, you know, the sane way; he'd really get the hump!
Admin
My god. Its full of typing.
Admin
Did anybody notice that (myList.Count < 1) is significantly shorter than IsListconntSmalleThaOne(myList) ?
Admin
Yes but in this case, using isEmpty() is better. (I asume there is an isEmpty method).
Admin
(!myList.Count) should do the job, assuming a sane language.
Admin
It's still better than sourcesafe.
Admin
Admin
if len(list) < 1: profit();
Admin
At least it's not VB.
/duck /run
Admin
I don't know, but it might not be thread safe
Admin
I see this kind of bullshit fairly regularly at my current job. Inane functions with misspelled words, random missing letters and my personal favorite, random Capitalization.
Admin
Admin
Our work is done on an inhouse framework (for better or worse) and has some nice simple functionality exposed to the developer, including a validity check method. For aggregated classes you just call it on all child classes and bingo, right... Not if you are our italian subcontractor:
bool result = (CheckValidity() != false) ? false : result;
yes, a doubly inverted comparitive self assignment, molto bene!
Admin
Everyone loves a holy war. Kill the beast!!
Admin
Its missing the unit tests...
Admin
public bool IsListconntSmalleThaOne(IList<IContact> listOfResults)
{
int count = 0; foreach (IContact contact in listOfResults) { count = count + 1; }
if (count >= 1) { return 1 != 0; // I don't trust "false" } else { return 1 == 1; // is "true" really true?? } }
Admin
What sane language could allow mixing of boolean and integral values?
Admin
Oops I forgot the code tags. Fixed :)
Admin
What sane language could allow mixing of boolean and integral values?
Admin
Obviously meant for embedded systems.
Admin
And he doesn't even guard for null
Admin
Admin
Admin
PHP or Perl
Oh, sane? None.
Admin
That's only if you want to look 1337 by showing off your ability to treat integers as booleans. The rest of us would just use a form of !myList.isEmpty(), which is much more clear and, depending on the internal implementation of myList, may well get better performance.
Admin
What about the obvious FILENOTFOUD?
Admin
myList.Count == 0
OTFY
Unless, of course, you're dealing with weird, unnatural, abomination-before-God data structures that allow lists with negative or non-integral numbers of elements.
I want to see a list whose count is 0.5.
Admin
Exactly the point I was going to make. It could be a list of antiIContacts!
Admin
Don't forget to handle case sensitivity.
Admin
Obviously representing one potential contact. 0.3 for a lead. 0.9 for that chick you ALMOST got digits from.
Admin
Oh my God that hurts. This is exactly the sort of shoddy coding that pisses me off the most. Atrocious spelling, useless method name, pointless functionality and it doesn't even work as advertised. But what really compounds the WTF is that this is so damn simple. When you screw up this badly doing something this simple, it's time to seriously consider whether software development is your calling in life. Note to the submitter, maybe you should leave a McDonalds job application form on his desk, see if he gets the hint.
Admin
Thanks. That makes it so much more readable (saner, too).
Admin
Pssh. Unlike the subby, you're not accounting for the case where there is a negative number of elements in the list.
Admin
Don't we have webservices nowadays to check for list sizes?
Admin
Your ideas intrigue me and I would like to subscribe to your newsletter.
CAPTCHA: conventio (a convention followed by this story's coder).
Admin
Kudos to the first to implement a TruncatedList collection class where you can index with floats and it somehow cuts the elements in pieces
Examples:
Admin
Sometimes it's better to write some more code just for the sake of code cleanliness, but this... this is just wrong.
Admin
Admin
public boolean isDoubleCheeseBruger(int patties) { if (patties * patties == 4) return true; else return false; } }
Admin
It makes perfectly sense, since in Italian double negation, well, negates. I am Italian, anyway: I have not said nothing.
Admin
The real WTF is that this is not an extension method.
Admin
Wonderful! You give me two patties and I will then inform you that I've handed you a double cheesebruger. Win-win.
Admin
Sorry, no time to play with strings, but for integers:
Admin
Clearly this person was getting paid by the line and was interested in creating a code-base which engendered long term maintenance to ensure job security.
Always ask yourself: "Is this a WTF or am I just missing the intent?"
Admin
Yeah, THAT makes sense!
Strings[0.25] = "T" Strings[0.5] = "Te" Strings[0.75] = "Tes" Strings[1] = "Truncated"
Exactly what I'd have expected!
Admin
There isn't. And it would be IsEmpty() if there were.
Admin
FTFY
Admin
C and C++ will both accept it too; as boolean values are simply integers, where 0 is false and any other value is true.
I personally don't consider it an insanity of the language, more a laziness of the people who can't be bothered to actually state what they're doing in their operation. Just because a language lets you do something doesn't mean you should.
"if (!myList.Count)" and "if (myList.Count == 0)" are functionally equivalent. The latter, however, is far more succinct, even if more verbose.