| « Prev | Page 1 | Page 2 | Page 3 | Page 4 | Next » |
|
IFRisTP0zTer();
|
Re: IsListconntSmalleThaOne
2010-06-09 09:02
•
by
anonymous coward
(unregistered)
|
|
Wow. That is insane.
|
|
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!
|
|
My god. Its full of typing.
|
|
Did anybody notice that (myList.Count < 1) is significantly shorter than IsListconntSmalleThaOne(myList) ?
|
Yes but in this case, using isEmpty() is better. (I asume there is an isEmpty method). |
Re: IsListconntSmalleThaOne
2010-06-09 09:09
•
by
anonymous coward
(unregistered)
|
(!myList.Count) should do the job, assuming a sane language. |
Re: IsListconntSmalleThaOne
2010-06-09 09:12
•
by
littlebobbytables
(unregistered)
|
|
It's still better than sourcesafe.
|
|
Re: IsListconntSmalleThaOne
2010-06-09 09:13
•
by
Dude
(unregistered)
|
|
if len(list) < 1:
profit(); |
|
At least it's not VB.
/duck /run |
|
I don't know, but it might not be thread safe
|
|
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.
|
Re: IsListconntSmalleThaOne
2010-06-09 09:17
•
by
Steve The Cynic
(unregistered)
|
WIN! |
|
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! |
Everyone loves a holy war. Kill the beast!! |
|
Its missing the unit tests...
|
|
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?? } } |
Re: IsListconntSmalleThaOne
2010-06-09 09:18
•
by
dignissim
(unregistered)
|
|
What sane language could allow mixing of boolean and integral values?
|
Re: IsListconntSmalleThaOne
2010-06-09 09:19
•
by
pbean
(unregistered)
|
|
Oops I forgot the code tags. Fixed :)
|
Re: IsListconntSmalleThaOne
2010-06-09 09:20
•
by
dignissim
(unregistered)
|
What sane language could allow mixing of boolean and integral values? |
|
Obviously meant for embedded systems.
|
|
And he doesn't even guard for null
|
|
Re: IsListconntSmalleThaOne
2010-06-09 09:29
•
by
Nahgoe
(unregistered)
|
You are also assuming that myList.Count is never negative!! |
PHP or Perl Oh, sane? None. |
Re: IsListconntSmalleThaOne
2010-06-09 09:30
•
by
Nick
(unregistered)
|
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. |
|
What about the obvious FILENOTFOUD?
|
|
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. |
Re: IsListconntSmalleThaOne
2010-06-09 09:34
•
by
Anon
(unregistered)
|
Exactly the point I was going to make. It could be a list of antiIContacts! |
Re: IsListconntSmalleThaOne
2010-06-09 09:37
•
by
Nick
(unregistered)
|
Don't forget to handle case sensitivity.
|
Re: IsListconntSmalleThaOne
2010-06-09 09:38
•
by
wtf
(unregistered)
|
Obviously representing one potential contact. 0.3 for a lead. 0.9 for that chick you ALMOST got digits from. |
|
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.
|
Re: IsListconntSmalleThaOne
2010-06-09 09:41
•
by
SR
(unregistered)
|
Thanks. That makes it so much more readable (saner, too). |
Re: IsListconntSmalleThaOne
2010-06-09 09:42
•
by
Satanicpuppy
|
Pssh. Unlike the subby, you're not accounting for the case where there is a negative number of elements in the list. |
|
Don't we have webservices nowadays to check for list sizes?
|
Re: IsListconntSmalleThaOne
2010-06-09 09:43
•
by
SR
(unregistered)
|
Your ideas intrigue me and I would like to subscribe to your newsletter. CAPTCHA: conventio (a convention followed by this story's coder). |
Re: IsListconntSmalleThaOne
2010-06-09 09:44
•
by
pbean
(unregistered)
|
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:
|
|
Sometimes it's better to write some more code just for the sake of code cleanliness, but this... this is just wrong.
|
list.get(Math.sqrt(-1.23456)); |
Re: IsListconntSmalleThaOne
2010-06-09 09:48
•
by
wtf
(unregistered)
|
public boolean isDoubleCheeseBruger(int patties) { if (patties * patties == 4) return true; else return false; } } |
Re: IsListconntSmalleThaOne
2010-06-09 09:56
•
by
timo
(unregistered)
|
It makes perfectly sense, since in Italian double negation, well, negates. I am Italian, anyway: I have not said nothing. |
|
The real WTF is that this is not an extension method.
|
Wonderful! You give me two patties and I will then inform you that I've handed you a double cheesebruger. Win-win. |
Sorry, no time to play with strings, but for integers:
|
|
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?" |
Re: IsListconntSmalleThaOne
2010-06-09 10:08
•
by
Your Name
(unregistered)
|
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! |
Re: IsListconntSmalleThaOne
2010-06-09 10:11
•
by
Someone who can't be bothered to login from work
(unregistered)
|
There isn't. And it would be IsEmpty() if there were. |
Re: IsListconntSmalleThaOne
2010-06-09 10:17
•
by
RobFreundlich
|
FTFY |
Re: IsListconntSmalleThaOne
2010-06-09 10:21
•
by
Someone who can't be bothered to login from work
(unregistered)
|
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. |
| « Prev | Page 1 | Page 2 | Page 3 | Page 4 | Next » |