| « Prev | Page 1 | Page 2 | Page 3 | Next » |
private boolean is04(String authCode) [Note from Alex: This was a typo when anonymizing it -- I've corrected this] |
|
You are number six!
|
|
I have no mouth, but i must scream
|
|
So is he also 'training' the developers to cram as much code onto one line as possible and to avoid the use of constants?
|
|
|
I wonder how they will handle the 'Case Else' ....
argh
|
|
Yeah, april fools. Too rediculous to be beleived - unless this is the output of some CodeWizard Tool.
|
|
private boolean isBrillant(String authCode)
{ if ("paula".equals(authCode)) return true; else return false; } |
|
*snicker* You said "cock". This code feels like burning in my special place. I work with a guy that likes to hardcode all sorts of crap like this, and he defines a function for every single thing. If he needs to create 30 different database tables, he'll make 30 separate functions to do it rather than one function that accepts a list of field names and types as parameters. |
|
What's the deal with these WTF's recently? Clearly, this is fake. We have not run out of real WTF's yet, have we?
|
No, over functioning is a real syndrome. I have seen it myself. |
|
Gosh, I love the fact that I can't use any BBcode, or HTML tags, or anything like that, JUST BECAUSE I'M USING OPERA. (Hint: Get a better fucking board)
Maurits said: --- private boolean is04(String authCode) { if ("02".equals(authCode)) return true; Uh... what? --- I don't see that, maybe Alex made a booboo and fixed it. |
|
Yep, mere moments later:
[Note from Alex: This was a typo when anonymizing it -- I've corrected this] Too bad I can't edit my original post, or delete it! |
Why do so many people have trouble spelling "ridiculous"???
|
I am not a number. I am a free man! |
|
Stuff like this is grounds for either firing the dumbass that did this, or promoting them to management. WTF man...
|
|
Can someone please tell me where that if(condition) return something; else return somethingElse; idiom came from? Why would you need to protect a return with an else? If the return is exercised, then the other clause is ignored! It's even in the original K&R book on C, written by the guys themselves, and it's no less idiotic coming from someone "authoritative." That, to me, is a serious WTF. |
And that's when Maarten De Cock slapped the developer with his ... hand. [:P] |
These comments are becoming as tiresome as the "first" posts. If it is so outlandish, that it looks fake, then welcome to the world of code maintenance. As I, and any other developer that works in the real world, can attest to, you see stupid stuff like this frequently. Instead of looking like a moron (anonymously) who has never had to work with other people's code, you should sit back and be thankful that you haven't encountered this type of crap in your job. (And yes, I am admittedly hostile about this because I have been debugging WTFs all day. On a side note, I think this site has jaded me to bad programming tactics...) |
|
Eclipse even warns you that it is a mistake.
Hooray for Eclipse :) |
Simple - so the next guy who comes along and adds a line of code doesn't cause something to break. This way its clear what is going on, when the intent is, and is more maintainable. |
|
This is obviously machine generated, so it's ok.
|
|
Probably because there's the E sound when they say it. It makes perfect cents!
|
At least it's properly documented! I wouldn't know this method returns a boolean otherwise. And the name |
|
Hah! Ha! Ha! Hah!
(Seriously: The Prisoner was awesome.) |
|
And, of course, the Real WTF is the forum software. (This coming from an anonymous bastard.) I was quoting the following...
|
|
I agree. I like the style:
if (condition) doStuff; instead of if (condition) { doStuff } I think it's more readable. I also like the idea of not counting on the returns to avoid the else clause. however, that's only when we are talking about long if statements (more than 5 lines at least). it looks pretty stupid to write as much code as they did when half the code would have worked.. (and that's not getting rid of worthless functions). And yes, people do write functions like that. people that went to college and memorized certain techniques about coding but never really understood the underlying theory and reasoning behind modularity. |
I agree, I have seen this many times myself. All you people who think this is fake are just a bunch of jackasses. |
This would be much better: private boolean is01(String authCode) if ("01".equals(authCode) == true) { returnboolean = true; return returnboolean; } returnboolean = false; return returnboolean; else { returnboolean = false; return returnboolean; } //and just to make sure, ie FileNotFound case return returnboolean; //end joke |
|
Or, instead of: if(condition) return true; else return false; How about: return condition; |
|
The idiom:
if(cond) return a; else return b; comes from a very reasonable place. It implies that b is being returned because cond was not true. If you instead write: if(cond) return a; return b; it implies that you are returning b because that is the appropriate thing to do if you reach that point, and is unrelated to cond. I strongly believe that when code layout and structure reflects the underlying logic, that is a good thing. David PS An even stronger statement of the idiom is: return (cond ? a : b); |
Opera is for hippies, gays, and terrorists. Use Firefox. It's what the cool kids are using. |
|
This is sort of a cargo cult thing. People do this because they
don't know why they're doing the things they've been instructed to do. As a result, they end up taking it all sorts of weird directions. Something like this would make a world of difference: private boolean isAdministrator(String authCode) { return "01".equals(authCode); } private boolean isFurniture(String productCode) { return "004".equals(productCode) || "005".equals(productCode); } Not just because the if/else is pruned out (that's a pet peeve of mine, and sure sign that the coder is still living in the world of C or maybe even VB), but because the method's name now makes it an abstraction. So now it at least has some worth. |
Yeah, screw standardisation and the basis of inter-machine communication, just as long as everyone's a squealing script kiddie and using the same "kewl" browser. Hey, I hear Firefox has the best support for "Web 2.0". lolz. |
Or, as I saw it in a few places while at Microsoft: return !!cond; Seriously. |
Obviously, it is the Authentic Author Authority Code. I am not sure whether it is a data value or the program code though. Sincerely, Gene Wirchenko |
Either it is a persistent troll, or some troll made one of this posts, and other have followed suite. This kind of WTFs are common. Trust me, Anonymous, I know. I know because I have done them myself, and I had to refactor some of them myself :) The sad thing here is seeing how the trolls here have run out of "brillant" trollings, and how they have to resort to bashing again and again the same trollings. Errrr, are you sure that I can't mod myself troll? |
Because people say it like they say words like redone remade and think an e belongs there. Now its obviously wrong, because I've never heard of someone diculizing someone. |
Is there a good reason to avoid the following, which reads more like normal English? private boolean isAdministrator(String authCode) { return authCode.equals("01"); } private boolean isFurniture(String productCode) { return productCode.equals("004") || productCode.equals("005"); } |
We must not go to the same parties. |
Bad reasoning. You probably have not heard of anyone ading a book either. Sincerely, Gene Wirchenko |
Believe it or not there are some college professors who strictly enforce such garbage. I experienced this first hand and still do not understand the full rationale behind it. It was in fact maddening. This specific professor always made us to do certain things for any bit of code: 1. Always put a comment with the performance metric (big O) at the top of every method written. 2. Always handle EVERY SINGLE case in a conditional and document it with comments. So with #2 you had code that looked like this just so you didn't lose 10% of your assignment grade for not following instructions. Love this WTF... (and no, not the operation performed, that is made up just to prove the point) // handles all negative numbers and 0 if (i <= 0) {i = i * -1.5; } // handles all numbers greater than 0 and less than or equal to 100 else if (i <= 100) {i = i * 1.5; } // handles all numbers greater than 100 else { // No operation to perform on numbers greater than 100} |
"Diculize" has actually made its way into the vernacular; it's when somebody passes out and you duct-tape them to the couch and draw on them with magic marker. |
Yeah! That is abserd! |
Yes. That code will throw a NullPointerException when productCode == null. You'd have to check that first, or assume that it never happens and pray. |
Okay, you got me, I was totally serious and you called me on it. Thanks. I now view the world in a different light. PS: homooperausersayswhat |
|
The real WTF is that they didn't write
/** (sorry could not resist, despite the obvious lameness of those IsTrue jokes) |
Sometimes the !! "operator" makes sense. In the C++ code where I work, we use COM objects, and "smart pointers", which are actually objects with a pointer and a reference count. The operators are overloaded so you can use them exactly like pointers. So "!spObj" returns true if a smart pointer is "null". So to see if it is NOT null, you use "!!spObj". It threw me for a loop the first time I saw it, but once you get used to it it makes sense. But in the case of a boolean condition like you mentioned... yeah it doesn't make much sense. |
|
!!cond is actually a C idiom for ensuring that the value is actually set to "true", where true =1 or -1 as the case may be for the compiler. Since in C anything nonzero is considered "true" when used in a conditional. (Because of the whole JNZ asm thing) However, that can lead to strange situations like having the following two if statements not be equivalent when x=5: if (x) // true if(x==TRUE) // false (and yes, this is needlessly verbose, but shouldn't be WRONG) So, in order to clean up the possible issue with int variables (and bool's didn't exist until disturbingly recently.. #define int BOOL was normal) using the !!variable would ensure that the variable was ACTUALLY either true(1) or false(0). |
| « Prev | Page 1 | Page 2 | Page 3 | Next » |