- 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
Other than of course... Q Words without U
Admin
My best guess from the way the code is written and the comments is that this is a student submission with a professor who requires comments on the code. I have seen many programs handed in like this in a much worse state with even stranger logic. But I know very few developers in the real world that comment code written this badly.
Admin
Couldn't even bring myself to finish reading that code after I saw him call extraBool.toString().
Admin
Of course, TRWTF is that it lets invalid formatting get through and render incorrectly, but given the alternative ... yeah, I really like this feature. And the pointless "Reply" button! And Akismet! Yay!
Admin
Admin
Which is still hysterically wrong. Not all English words with Q have a U, but those words do have another vowel.
Admin
Fastest one wins, but you have to check the submission, of course.
CAPTCHA: nobis -> nbs
Admin
6 Month ago I would have called that a fake. Then came the 'very very good Java-Developer'. He's long gone now - but this article made me realize I'm still depressed. It's like watching American-Idol where you ask yourself: "Does he really believe that he can sing, or is it an really good actor bullshitting me".
Admin
I am a new employee for a software company controlled by developers who regard comments and program verbosity as blasphemies. We use Python as the primary development language so pep8 is rigidly and sometimes fanatically adheared to. Almost nothing is commented or documented. Whenever I ask how something work, I get the reply 'just read the code newbie'. Not an easy task considering the problems we are trying to model are fairly complex and understanding how to solve one problem often requires diving into the program core where any sense of structure has been flat out crushed long ago due to hacks (undocumented of course, read the commit logs newbie) which have accumulated over time. Most of the comments I have submitted in the code have been flat out deleted. Whitespace such as blank lines is another offender and if you include any such blank lines in a commit you can almost be sure that the next commit will have erased them. The end result is a very dense codebase where everything is unnecessarily complex, it's hard to tell special cases from general ones, variables are inherited, passed and modified all over the place, and the structure is invisible. I am often at a loss what exactly our functions do because I have no idea what input they get or what exactly they output. Making changes to the code is time-demanding, expensive and frustrating due to the amount of technical debt that has accumulated over the year. But hey, at least our codebase follows Pep8.
ps. The official Python documentation is shit.
Admin
Well, nobody expects the Spanish Inquisition.
Admin
Admin
Sky
Admin
Comic genius. Funniest piece of code I've seen in a long time.
Admin
FTFY. (note: I read the other day that the .NET runtime is optimized for upper case string comparisons.)
Admin
Everyone is forgetting that W can also be a vowel. So the code isn't even complete.
http://www.quickanddirtytips.com/education/grammar/when-is-w-a-vowel
Admin
see: http://stackoverflow.com/questions/9033/hidden-features-of-c#12137
Admin
This is literally the worst code that I've ever seen.
Admin
I like wikipedia, it really has anything in it:
http://en.wikipedia.org/wiki/List_of_English_words_containing_Q_not_followed_by_U
Admin
aside from the fact that he loops through every character in the string then returns in all cases so it isn't really a loop...
Of course if it contains 'y' it should return FileNotFound.
Admin
The default case maybe covers the blank tile which can be used for any letter so it might be used for a vowel or for a consonant.
When I play WWF, "QI" comes up very frequently. Especially with my opponent who just loves making 2 letter words. No not parallel ones, just puts down one letter to make a 2 letter word. Or 2 letters making such a word attaching one of them.
Admin
To comment on the actual subject - we've found that putting comments in the code isn't actually very useful, anymore, given our current tooling.
Our commentary on the code is going into our version control software. And with a decent VCS, it's easy to identify all of the places in the source tree that were modified as a part of a specific change, or to identify which lines in a given file were part of which change.
So, when I'm looking at a line and I don't understand it, I can easily find out which revision created that line, and what other changes, elsewhere in the code, were made at the same time. And the provides a context that a simple comment in the code cannot.
Admin
This code is inexcusably poor but break after return is not IMHO necessarily bad code. Sure its unreachable; but anyone reading the code or mentally evaluated the function for a given input will know that when they hit the 'return' they can stop running down that branch with total confidence.
What it does do is keep your switch/case/select statement symmetrical which makes it visually quick to check you have not omitted a break where there should be one.
It also means that if you refactor and take that return out that break is there, and you don't forget it resulting in unexpected fall thru behavior.
While we are on the subject isn't 'break' the real wtf in all the C syntax mimicking variants of switch/case/select in other languages? I have been programing a long time and the percentage of the time I want the fall through control flow rather than a break after each case is tiny. I with the default flow was break and you make things fall thru with 'next' or something.
Admin
"You suggest we should have talent shows for programmers on TV?"
=> FizzBuzz seems to be enough to sort out that kind of programmer...that's the new talent show in my company (small variation of FizzBuzz). That's nothing and every C.S.-studend can solve that in a minute, I once thought. Try it, and you will have a hard time believing what 'very very good Developers' are capable to produce. Of cause I sucked too when I started Basic on my C64. But I knew I sucked. That's what I just don't get with those people. Maybe it's some kind of a phychic desease or something.
string extraMegaBool = "FIND_ANOTHER_JOB".ToString();
Admin
I do that for exactly the same reasons. But it still feels a litte weird, so I apologize in the comments.
#pragma warning disable 0162 //unreachable code => switch => case => return => break; Sorry I like the unnecessary breaks
Admin
If this was not an overly-confident student's programming assignment, then my only other theory was busy work for the president's daughter.
CAPTCHA: ideo - an term used to describe those stupid enough to pass of 101 assignments as mature code.
Admin
Actually the loop always returns period. In every case.
Admin
You are truly blessed. I'm sorry to say that the codebase at my job, while actually compiling, is significantly more asinine than this.
Admin
Admin
Admin
Admin
Admin
So am I the only one thinking that the "Q requires U" comment was in jest, as in it would be something stupid that this person would do?
Admin
Please don't excuse bad code. If you can't tell that a return statement will make the loop only iterate once, you shouldn't be touching code.
Admin
I use switches pretty sparingly myself, but it's amazing how many switches I see that are like that. Where, for some reason, a huge part of the population treat the default as if it's some kind of "it should never get here but just in case" fallback. It's one of those things I see so often that I can't help but think - wait, am I the one in the wrong there for using the default as an intentional "if not this specific stuff, do this"?
No, it's the children who are wrong.
Admin
SKIIIIIIIINNEEEEEEEEEEEER!!!!!!!!
Admin
Admin
Admin
And when you enable the default set of MISRA-C warnings, it also gives a warning when there is NOT a break after a return, for the rule where every case of a switch statement must have a break.
Admin
Schrodinger's Break?
Captcha: Suscipit; For when I suspect- oh whatever, just skip it!
Admin
//this creates my "extraBool" which is a fantastic way of handling additional //logics so that as well as true & false, we can also have like no value string
"like"
Valley girl ?
Admin
Strč prst skrz krk
Admin
I refuse to accept that a word is an actual word if it doesn't contain at least one vowel. This real world experience makes our method much cleaner:
public static bool HasAVowel(String theword) { return true; }
Note that this even works if the input is null which is, as you can see, a word with a vowel.
Admin
Well, no. If you are using a clean case -> break for each case, then maybe you need to restructure your project so as to use a series of subclasses or something. The advantage of a case statement is that you do have the fall-through option, and that you would use a switch precisely when you need to implement the sort of thing that lends itself to the fall-through behaviour.
Admin
Actually now I think about it, I wonder whether the code originally didn't have the Return statements in it. Then it would loop through every element in the character string, doing its incomprehensible shit. The developer realised it was doing the wrong thing and thought: d'oh! as soon as i've found a vowel I can return! Then overthought it and added return to all cases.
Admin
I was wondering if anyone would mention 'w' as a vowel.
Admin
Yes I bloody did ages before this bozo, can't you bloody read?
Admin
As a pedantic programmer, I do have to mention that "anyone" != "first one"
Admin
As any good scrabble player will know, q is not always followed by a vowel: tranq, umiaq, and suq.
Admin
Oops.
Admin
You mean, like in "Iraq" or "QED"? :-)