- 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
This is literate programming, isn't it?
Admin
Hmmm.
I'm probably wrong for doing this but I generally prefer to code the first way rather than the second. Mostly to ensure that the code is as obvious and explicit as possible. You can never tell who is going to replace you, or work with you, so I try to make code as idiot-proof as possible.
Admin
I once worked on a (COBOL) program that was filled with statements like:
I asked the programmer what the "if" was for. If it was zero, wouldn't adding it in result in not changing the total anyway? He explained that this would run faster because it would save the time to do the add when it wasn't necessary. I tried to explain that an "if" statement takes longer than an add, so even in the cases where it was zero, his version would take longer. I don't think he even understood what I was saying.
And I just recently was working on a Java program with the fascinating code block:
I changed this to "purchaseOrderNumber1.compareTo(purchaseOrderNumber2)!=0" and consolidated the two blocks of code. I considered using "equals" but thought just barely maybe there might be some catch to that. The original programmer complained loud and long (about this and several other similar changes) that I was screwing up his code, went to my boss and my boss's boss to say that this could introduce all sorts of difficult-to-find bugs, and demanded I restore it from SVN. The boss finally said to change it back to get him to shut up.
Admin
The real WTF is the curly braces on a line by themselves.
Wait... converting the good way of using braces to the annoying way would be a good way to check in more lines of code...
Admin
I don't like to read threads before commenting--has anyone mentioned the Diebold voting machines yet?
Admin
Does that mean I have to read the whole thread?
I'm not sure my failing eyesight can cope with this.
Admin
Admin
It's never worth it.
Trust me, it really isn't.
Admin
This sort of thing, and a lot of other WTFs, occur because it is simply too easy for anybody to write code.
If we went back to entering software only on 80-column punched cards, people would have to actually think before they coded.
Besides, what's wrong with using "A", "BG01F" and "II' as function or variable names anyway?
Admin
But German agglutination is so expressive and we really miss it in other languages ;-) But I do not see any agglutinations in the names, it is all camel case. Agglutination in german is combining two words to a single one: e.g. "capital letter" becomes to "capitalletter".
If you combine two nouns (fist letter in german is upper case) the fist letter of the second word becomes to lower case:
Baum (tree) + Haus (house) => Baumhaus.
That is the difference to camel case.
Admin
Admin
German agglutination, whatever that might be, is a decent stab (from the eighteen century) at ignoring latinate transgressions of the natural flow of the language.
Unfortunately, that doesn't work too well, and hasn't since the eighteenth century.
The (excellent) solution was to replace individual Latin words with the German equivalent -- thus, "umstand."
Not, however, a natural way for a Germanic language to evolve, unless you happen to be a diplomat, or a literalist translator of the Bible, or some other sort of plonker.
You need to examine Swedish.
Now, there's the ideal of a Germanic language.
Admin
Of course I meant "first". But misspelling it twice was consequential ;-)
Admin
gasp1!!!
Admin
Edward you are definitely wrong for doing that. If the idiot can't figure out what variable = expression means, why do you think he'll understand if(expression)?
Sander please don't "refactor" code to do the EXACT opposite it did before.
Admin
Is this the Diebold source code?
Admin
The scripting language in the PC game "Space Empires V" is even more atrocious... not only are the names horrendously long, but they're prefixed with "Sys" and words are delimited with underscores, e.g.
Sys_Empire_Log_Get_Log_Entry_Message_Treaty_Elements
(According to the documentation, this function "sets variables with the values of which players are participating in a treaty"...)
One intrepid modder actually wrote a Perl script to parse the scripting docs (in PDF format!) and create aliases for the functions, so that you could call the above function as any of the following:
SysEmpireLogGetLogEntryMessageTreatyElements - the "condensed" format Empire_Log_Get_Log_Entry_Message_Treaty_Elements - the "no Sys prefix format" EmpireLogGetLogEntryMessageTreatyElements - the "slightly resembling a real function name if there were only a '.' or '->' or something between EmpireLog and the rest to denote some sort of dereferencing" format!
Admin
Is this the Diebold source code?
Admin
Admin
You mean
Admin
Captcha: incassum (Inca's sum? Exactly how much gold do I win?)
Admin
Admin
Heh, finally we get to audit the Diebold source code.
Admin
I prefer TalesFromTheLongMethodNameGenerator(int minLength)
Admin
Of course he's serious (sorry if you're female Chucara, you're getting the default pronoun).
3 letters is all you need. Give me one good example of when 3 letters isn't enough and I'll show you a pitching pony.
And to those of you who think this is from Diebold's source - you're wrong. This is from your source code. The government controls how you vote.
Admin
Admin
Ja, az.
Captcha: secundum.
Admin
Now consider a recursive function.
Admin
Diebold, is that you?
Admin
I hope that's not code from an electronic voting machine...
Admin
This looks like a thing I had the unfortunate experience of being enslaved to called:
AESM - Accenture Election Systems Management software.
Tell me, is there a thing called the QueryBlock to be found in that code?
Admin
Damn, I pay off a bunch of so-called programmers to rig the election machines and they come up with crap like this? No wonder it didn't work!
Admin
Sony are still winners: A real psp library function: sceKernelLoadModuleBufferForLoadExecBufferVSHUsbWlanDebug also, sceNetAdhocTransferGetMallocStatParent they also name their different engines after subatomics and/or star trek: scePowerGetCurrentTachyonVoltage