- 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
I think this wins best post of the thread award :)
Admin
Another programmer went insane after spending too much time with Java. I'm glad that I'm not the only one... :-)))
Admin
If you really believe that you have NOT spent much time over at Sharktank. Random series of characters can be much more fun as they make non-sense words that might actually seem to be new words that relate. Then you not only get people posting their CAPTCHA text you get another paragraph explaining how it relates.
Admin
Just need to &#$*ing learn the language properly...
Class cls = String[].class;
This is the so-called 'class literal' - use it, when you need meta class information about any type you do not have an instance from (and do not want to create one unnecessarily, like above!). 'cls' contains exactly the same information as cos[0] in the above snippet. This works even for primitive types ('int.class' etc.) and the 'Void' meta class.
This is only the most articulate WTF in this part of the code. Another: if you absolutely have to create an empty array, use [0], not [1]... Yet another: why Class[]? Class cls = blah.getClass(); suffices... This shows that most of the distressed comments could've been avoided, had the programmer known enough of the language in use (Java in this case, but I've seen similar in C, C++, C#, VB(A), Basic, Cobol, Perl, JavaScript, LISP, Fortran and I don't know what else...).
Know your tools. And if you are too lazy and/or dim to learn them properly, use simpler ones or seek new challenges in different areas than software development. Thank you. ;o)
Admin
I am working on a DOD contract. And I think you have been LOOKING OVER MY SHOULDER !!!!
Admin
Just when I thought that the front page posts were going downhill, this was the first to make me laugh out loud at work. "If we're not getting the database, just return some random numbers instead" is an inspired decision indeed.
Admin
Admin
The REAL WTF is that not only Java doesn't let you overload operators, it internally supports SOME types of overloading but not others.
For example, we have:
Now saying
Instead of
WILL WORK FINE!!! Even though it's an overload of the plus operator which in this case works completely different from when adding two integers (if integer addition would work like string addition in Java, then saying "1 + 2 + 3" would result in 123 instead of 6).
HOWEVER, saying
WILL NOT WORK, and you instead have to use
So plus operator is overloaded but comparison one isn't, and you have to stick to the system because you can't change overloading yourself either. Talk about stupid...
Admin
That's fucking stupid. Fuck you
Admin
Admin
Admin
My daemon() function used to have the corresponding getTheeHenceToEndlessNight() signal, when I didn't want the daemon around any more... Yes I know, daemon != demon...
Admin
Sometimes, the environment just isn't sane.
I've seen VB.NET code where
if booleanVariable = true then DoSomething end if
ExecutedDoSomething
whenbooleanVariable
was false.Doubtless due to state corruption in the development environment, since restarting fixed the problem.
But it's good to remember that sometimes it's not the developer that's crazy - it's the environment.
Admin
PS. It helps if you really click "preview" when you mean "preview" rather than "submit".
Admin
I've noticed a strong correlation between people who make comments like this and people who think they're funnier than they actually are.
So I'm glad we aren't friends!
Admin
Admin
Sometimes my explanation just makes things worse, and you have to read the code in order to understand the comments. I try to warn people when this happens:
;// On dropdown, fill the reasons field presentation list ;// with all the reasons which are valid for the type of ;// the current entity which are not already used in a ;// binding of the current entity to the selected product, ;// plus the value in the current reasons field, to serve ;// as a default selection, but only if it is previously ;// selected, and this will be on the mid-term exam.
I added the following comment to a wrapper that translates a directory spec into a database spec, hence the reference to the babel fish scene in HHGG:
;// Application designs can store general file ;// directory specifications in addition to ISAM ;// database locations as BDE alias definitions in ;// the associated IDAPI configuration file, but ;// you'll need to have this fish in your ear.
It's a way of saying, yes this comment is exceptionally long and totally opaque but I am not going to lose any sleep over it and I don't think you should either.
-Harrow.
Admin
Admin
yeaaah!
Admin
From various projects I'm working on:
Admin
Ugh, I remember working on a project in an old VB version (6?) that was just a nightmare. I'd decide I didn't want some code and I'd delete it, then I'd run the program and it would _run_the_code_I'd_just_friggin'_deleted, even after doing a full recompile. I'm not joking. Getting VB to work just right and actually do what it was supposed to was sort of black magic, and involved restarting the IDE and inserting/deleting code in just the right places.
Admin
I appreciate your fervor. However can you please direct that to other forums? Ones where people have enough education to respond in a like manner?
Admin
Admin
Admin
'//go go gadget report '//go go gadget search popup '//go go gaddget smurf
'/* ON ERROR RESUME NEXT IS FOR FUCKING RETARDS YOU FUCK VB ' PROGRAMMING IDIOT IT'S SIMPLE TRY ... code ... CATCH .. USE ' THE EXCEPTION FOR SOMETHING EVEN IF IT IS ONLY TRACE OR 'DEBUG.PRINT ... FINALLY TRY TO RECOVER THE RESOURCES ' WHAT ERROR YOU SAY??? */
Admin
That's the first time I feel offended by a piece of code...
My finding is pretty weak compared to those... in the phpBB source, above a major loop that processes the posting data fetched from the database:
// Ok, now let's do the loop, yeah baby, let's do the loop...
Admin
You should be doing it like "No".equals(Jack.PlayQuantity) to avoid the possibility of a NPE. :D
(NPE = NullPointerException).
captcha: doom... yes, NPE = DOOM xD
Admin
The real WTF (OMG, I hate that phrase...) is people feeling compelled to criticize languages/language features without knowing $.02 about them. No, the "+" operator is not "internally overloaded" in Java, its implementation is merely a compiler trick:
String c = a + b;
translates to
String c = new StringBuffer(a).append(b).toString();
(or String c = new StringBuffer().append(a).append(b).toString(), which is functionally equivalent).
A similar thing happens for the concat()-method of String, because String itself is immutable (for very good reasons!).
BTW, as of Java 1.5, StringBuilder is used instead of StringBuffer (the former unsynchronized and the latter synchronized as the only difference).
boolean d = (a == b);
does of course work, it only compares the references (so 'true' means both are pointing to the same instance). The same holds true for the assignment operator ('=') which never works like a C++ copy constructor, i.e. it always copies references, never instances.
Java does not have operator overloading - whether this was a good decisison or not may be debatable (as is the decision to add the "+"-compiler-trick for Strings). But operator overloading was in fact one of the major sources of misunderstandings and errors in C++, therefore it was left out.
Think about it - let's assume that the equality operator ('==') was overloaded in the above example. How would you tell whether the developer intended to compare the references (original operator) or the inner states (overloaded operator)? This is the main problem with operator overloading: Additional and potentially confusing implicit behaviour ("side effects") which is hard to see when reading code.
It is in fact astounding how much inane code is still produced in a language like Java, with most of the problematic and complex stuff of its predecessors (pointers, explicit memory management, operator overloading etc.) left out... but it's no wonder really, regarding the multitude of equally inane comments in these forums...
Admin
I may be wrong here, but aren't primitive types in Java actually handled by value? As far as I know, that's the different between bool (lower case) and Boolean (upper case, the boxing type).
Example: bool a = true, b = true; return (a == b) // Comparision between values: true == true -> true
Boolean x = new Boolean(true); Boolean y = new Boolean(true); return (x == y) // Comparision between references: [Adress of x] != [Adress of y] --> false
Note that NOTHING of this is a WTF. You just need to understand things before you talk about them. In this regard, I fully agree with the previous poster.
Admin
Correct idiom here is:
Class cas = String[].class ;
Admin
Nothing astounding about it really. It's simply that most people who actually can program, don't want to program in java. VB has even more complex stuff left out and just look at the number of WTFs written in it. And leaving out features just because people have trouble with it - well, you can't drop the steering wheel out of a car just because some people have trouble steering.
captcha: ninjas - they don't program in java either.
Admin
Admin
Not a comment, but always found the following configure script message for Eterm amusing: ... ... checking for life_signs in -lKenny... (cached) no Oh my god, they killed Kenny! You bastards! ... ...
Admin
A buddy of mine told me that at a company he worked, one of the metrics they used for determining when a piece of code was ready for release was the number of occurrences of the "F-word" in the comments. As that number approached zero, the code was closer to release.
Admin
A couple of notes on people who can program:
People who can program choose the best language for the job, and sometimes that's Java or even VB.
People who can program sometimes don't get to choose the language they program in, for example, when management suddenly decides to switch to .NET.
People who can program can program, and do it well, in any programming language.
And one note on poor analogies:
The ostensible double-you tee eff (captcha!) here is that so many of the commentators think that the fact that those absurd comments were embedded in Java code is somehow important.
Admin
No, it's Brillant!
Admin
Yes, and if floating point addition would work like integer addition in C, then 32768 + 1.5 might equal -0. Are you trying to claim operator overloading where users are not allowed to add new overloads is a bad thing?
Admin
I just found this in a class I'm looking at to try to find out how to access something:
<some if statements that return stuff depending on a Type parameter> else return null; // Hmmm.. is that dangerous?Admin
those who complain about java have not tried cold fusion's poison
Admin
Admin
Mmmhm, seems to familiar, the submitter could be a co-worker of me ?
No probably not I hope, such coding may be relieving for the dying brain but using such comment in for example vb asp or asp.net pages are no fun. In my experience I've heard too many angry costumer on the phone reading errorcodes like : OMGWTFBBQ!!! or 0w cr4p! from their screen.
Fortunately they aren't internetgeeks or gamers who know such verbs but the next coworker of mine who uses such comment is bound to be a stress outlet for me. >:)
Admin
I am Jack's poor, damned soul.
Admin
To all those people who posted their own page-long rambling comments: you are all incompetent hacks. I hope you die in a fire before I'm ever assigned to maintain your code.
OK, so I didn't mean that. I'm sure you're nice guys who are just trying to make a living. But so am I, and my life would be much better off if you people flipped burgers. So please, consider a career in fast food. It may not be as glamorous as grinding out crappy code for applications that will be used for years on end by people who neither understand nor appreciate your efforts, but you can still earn good money if you rise through the ranks. In the end, I'm sure it'll be better for all of us: you, me, the end users.
The comments just make things worse. No, really. At least uncommented code allows me to imagine some much smarter person just had a run of unfortunate circumstances. An inner monologue where the programmer struggles with his own incompetence and curses at life takes away all doubt. If you have time to write comments like those, it's obvious that you actually needed much more time writing the actual crappy code -- otherwise you wouldn't be wasting your time on inane comments -- and that just makes it all the sadder.
To those people who are proud, or at least amused, by comments like those: you are not a professional programmer. The world has enough amateur programmers. Please stop coding. And if you think all this sounds arrogant: you're damn right it is.
Sorry, had to get that off my chest. We now return to your regular programming.
Admin
Aren't we a zealot!
CAPTCHA: atari cuz thats what I wanna play
Admin
Suffice it to say that you're the kind of person that makes me realise why for so long software professionals were seen as a humourless and socially inadequate underclass and hidden away from the rest of the organisation...
Admin
At least funny comments brings a smile... My legacy code is a I-used-to-write-C-but-now-it-is-C#-but-i-will-NEVER-learn-oo-techiques-heap-of-shit with absolutely no comments!
Buhu!
/P
Admin
Yeah generally I don't comment the code until I refactor it or I have time to come in and clean up (refactor?) and comment...
Admin
Someone once said "You can write FORTRAN programs in any language."
Admin
I am bored so I came back to comment again....
I think the person who wrote this code could be a madman....
But, then I've always thought I was madman.... CAPTCHA: darwin (yes I know you really wanted to know what it was)
Admin
looks fake...