- 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
Never mind "the real WTF is..." I can't believe I read through over 100 posts and not one of you uber-CurlyBraceLanguage developers has commented the BUG is this routine:
The user's Signing permissions don't matter. If he can Close, He can Sign. Oops. (Sure this is probably a transcription error during anonimization, but maybe not.)
Assuming that's not the case, in Java Wizard's attempts to over-comment the routine, which resulted in overly-long identifiers and suppression of boolean short-circuiting, he probably resorted to Cut/Paste/Modify (because the variable names are so long), and THEN forgot that ever-important Modify step.
Not that I've ever done that. After all, I code in VB. I must suck. <FONT color=#ff0000>;-)</FONT>
Admin
This is the SUPERSLAM OF THE YEAR.
Admin
Well, descriptive (and therefor possibly long) names are not a bad thing per se (perhaps the "Java Wizard" used to be an "Ada Wizard" before ;o), but this holds mainly for identifiers that are publicly visible (like HasSpecificPermission() might be in the above sample - however, we do not see if that is so, I'm merely assuming it).
There is a minor WTF here, because naming conventions demand the first letter of methods to be lower case, and putting the parentheses on single lines is inane. "SpecificApplicationPermissions.CompleteClosingStep" might also be questionable depending on it's declaration: if it is a publicly modifiable attribute, it violates the concept of encapsulation, if it is a constant, it violates the naming convention for constants (all uppercase) - a "Wizard" should know all this.
There is OTOH not a lot of sense for local (!) variables like the 3 booleans to have names of around 40-50 characters. If one needs such long names because the method bodies have a LOC count of 200+ lines (or perhaps 1000+...I've seen that), then the problem is most probably lurking elsewhere, the developer is obviously writing procedural code with an OO language...
I'd not consider this a real bad case of a WTF, "self documentation" of code is not bad, replacing the overly long local variable names with code comments would be better still.
CAPTCHA: poprocks :o)
Admin
Oh, bad forum. Bad, bad forum! Anyway, I admire your punctuality.
The image of a professional impostor?
Now, while I see no point in following the clothing standard of the establishment as you do for sheer ego masturbation, I don't dress like a homeless either. But I'm absolutely certain that I wouldn't want to work for people who disrespect those in need.
Sad to hear you're such a superficial little fuckhead. Maybe I'm just too blind to see what wearing a phalilc symbol round my neck will do to improve my coding or other mental abilities. Intuitively, I would say that the only possible effect is to impede blood circulation to an organ much involved in these activities.
I myself have found that while many capable developers do groom, the only IDE most of the suits are really experts at is Powerpoint.
What went wrong? Weren't you properly dressed?
Gucci and Versace will be glad to hear that they could help!
Maybe I am mistaken and your pride and vanity will actually get you somewhere. But then, who can say whether this will be a desirable place or condition?
Admin
The real wtf is that post.
Admin
Reminds me of (earlier versions of?) Borland JBuilder. The Java compiler allowed you to use, err, unusual characters in symbols. Now the funny thing is that the character FF hexadecimal (easy to enter using Alt 2-5-5 on a Windows PC) was one of the characters permitted in symbols, although it just looks like a space in most fonts, and the syntax highlighting algorithm of JBuilder actually treated it as though it were whitespace!
This means you could type things like (I'm using underscores instead of FF characters for comprehensibility :-) ):
etc. In the IDE, it would look like a monkey just pulled random keywords out of a bag because all the bogus keywords seemed properly spaced and were highlighted as keywords, but the code would actually compile and run. Great for playing pranks on coworkers ("You don't know what abstract default member variables are good for? You got to be kidding!"). Not that I ever used that in production code, though...
Admin
The compiler just doesn't care about newlines (the preprocessor does), that's not the same as saying they are "one line", only they could be written entirely on one possibly gargantuan line (if you don't use any preprocessing directives, that is).
Admin
-- The PHB
(<code>s mine)
Admin
Admin
Wow, you must be a real Debugging Wizard. ;-)
Or the resolution of your monitor is set waaay to low.... ;-)
Admin
Why is it so hard to believe that someone can write that off the top of his head?
Admin
<font size="2"><font face="Arial">And I would like to see some of the VariableNamesShouldBeOverlyDescriptive crowd getting any productivity without the pampering of an auto-completing IDE. Remember that short naming conventions have been around since before there was such a thing as an IDE.
What this universe needs is a version control system that has an option on check-out: 'Novel mode' and 'Program mode', where 'Novel mode' automagically replaces variable names by the comment in the declaration.
</font></font>
Admin
Admin
"What he's got is three booleans created expressly for the purpose of setting another boolean"
I see not much wrong with the Java code.
Stylistically, I would not mix "RequiredFor" and "RequiredTo", probably replacing both with the simpler "To", and I would leave out the comments (comments to explain what a statement does are evil :-)) but that is it.
If I saw all the code, there might be other changes I would make. For instance, 'currentInteractiveUser' might become 'currentUser' or even 'user', depending on the context, and the fragment shown might be refactored into a function (with Javadoc comment)
Admin
That's probably the WTF! Who would have thought that VBA has functional capabilities?
Admin
Admin
That would hold true every place I've ever worked. Oh, apart from people catching on.
Admin
LOL. We must have pictures!
Admin
I believe that is called failure to communicate and blowing smoke up your @$$ at the same time.
Admin
<FONT face=Tahoma>So what happens when a user has a permission to InitializeClosingStep but has no permission to CompleteClosingStep?
And about the "<insert a buzzword here> <insert 133t noun here>", at school I was once called the person who eats compilers for lunch... I don't know who came up with that description, I didn't even knew anything about a compiler that time except it checks for syntax errors and make executables... :)
I really didn't like the thought and I know for myself that I still have much to learn...
Also I wouldn't like to be called that way because I only knew basic java, some COBOL and a lot of VB that time...
Besides, "Viceroy of VB" was already taken... :)
</FONT>
Admin
I used to do heaps of UI work, including a lot of lower level graphics programming. I always used colour for instance variables. You can easily see that Color represents something incomplete and not entirely usable, whereas a colour is generally ready to go..... I don't care if someone else may have to maintain it.
Yeah, That just speaks to me. I read that and know what it means straight away. I don't even have to read a crap load of code to figure out the context. Um. Action is a noun, right? Oh, I get it. You mean action as a verb. Thanks for sharing your learnings. Way to leverage the synergy! WTF?
Call me the Lord of Lego Logo.
Admin
I'm reeling from the sheer WTFness of a boolean named 'yes'.
Admin
Well, it is grammatically incorrect. Perhaps the words wasn't checked properly before posting.
Admin
Please use Java Coding Conventions when writing Java Code. I agree that the Java Wizard example is a bit extreme, but if I have a choice between short, unreadable method names and long, unreadable method names which at least convey what the hell they're doing, I'm all for the latter.
Admin
Same where i work. I usually equip 2 of these http://en.wikipedia.org/wiki/Brass_knuckles when having to speak to my boss.
/Duckie
CAPTCHA: bedtime
Admin
No, it isn't. It's just that the grammar checker is confused by all the long words.
OTOH, "the words wasn't checked" is grammatically incorrect.
Admin
Wow! Well, actually I see code like this once a week or so. Take a deep breath, step back from the keyboard. Are SIX words really required to describe your class? Don't you think something is fundamentally wrong here?
If I saw this code where I work, you'd be invited over for chat, then out for beers if you could explain your thinking well. At the end of the day, code like this would vanish from our codebase!
Admin
Ohhh snap, I was waiting for that. The class I extend comes from the Spring Framework. Yeah, those guys don't know what they are doing in the Java world rolls eyes. At the end of the day, if code like that vanished from your codebase, you probably end up with the same WTF crap I see everywhere else.
Admin
Billy,
Those guys obviously do know what they're doing in the Java world. They've take a weak OO language and built a good OO framework in it (i.e. all the meta stuff and dynamism you expect in CLOS, etc.) But at the end of the day, you wind up having to write a lot of code to fight Java's lack of expressive power, and you tend to wind up with verbose names just to keep everything straight in your own mind (a solution that, sadly, occurs often - witness the nightmare of Hungarian notation.)
I think most of the WTF crap we see, at least on dwtf, is produced by incompetents: no framework or language will every help the authors produce anything worthwhile.
What irks me about the endless enterprise layers on top of Java is that managers repeated the same mistakes they made with Cobol, etc: seeing that only the top 10% of the programmers seemed to produce anything useful, they bought into B&D disciplines with the hope of making, say, the top 50% productive. All this succeeded in doing was lowering overall productivity by reducing the effectiveness of the few good programmers.
Admin
-Wang-Lo.
Admin
Of course, it has that -- Ctrl-P :-)
Admin
Wow - talk about lashing out! You've gone from one extreme to the other, don't you think? Regardless of capability, a person who chooses not to groom (at least a little bit) is going to be viewed differently than one who does; that's just human nature. While I disagree that a tie is somehow necessary, I think that there has to be some level of effort.
My point is that I agree with both of you in certain respects
1. A person who pays little attention to their own hygiene, regardless of ability, is hard to take seriously
2. A person does not automatically get respect based on their outward appearance.
My code doesn't get better if I'm wearing a tie - but it's far easier to work with my team if I (they) don't smell bad. And it's a LOT easier to get along with management if our clothing is presentable (they don't understand what we do anyway)
Admin
<font color="#ff0000" size="+3">END OF HYGIENE FLAMEWAR</font>
Any further attempt to post another off-topic post about hygiene, smell, deodorant etc. will end here.
Admin
<FONT face=Tahoma>I'm starting to like this moderation method... :)
Uh, "Flameware"? Is this some kind of flame generating software?
</FONT>
Admin
Thanks, fixed that. Worked anyway (it always does, one way or another)
Admin
It's probably in C#, and the permissions are probably an enum. And what's wrong with "AppPermissions"?
The WTF is that this guy was a 'wizard'
Admin
I've yet to see anyone come up with aDecentReasonToUseReallyLongNames. "they sort the same alphabetically" is a bad reason - I hate the way Visual Studio sorts method names alphabetically. Everything should appear in the order it was defined! (or there could be a button beside the dropdown to toggle) VS is obviously designed for people who don't know the code, and designed to reduce productivity of people who do know the code, resulting in higher turnover at companies using VS, thus resulting in more people who don't know th ecode.
And besides, there's no reason you can't make the names sort together alphabetically and also use shorter names.
I also hate IntelliSense. Half the time it picks the wrong thing, and it's used as an excuse to make names overly verbose. I also have to use it, because error codes are Constants.blah.blah.blah.blah.errors.BlahBlahFailedBecauseBlah (the reason for all the .s is because intellisense sucks - decent autocomplete would merge similar prefixes, and for AaBbCcDd and AaBbEeDd show "AaBb...").
Code readbility is the inverse of time it takes for you to figure out what the hell a particular function does. The people advocating short names are proposing stuff like canSign, canApprove, canClose. These are GOOD names - anyone reading the code, knowing the relevant context, will know what the variables mean. Anyone who doesn't know the context won't be helped much by longer variable names.
Variable names should be concise but meaningful. In particular, I should only need to read about the first three words to figure out what the hell it means. Differentiating variables by how they end is
one of the more horrible things about IntelliSense - who can read that far?
And underscores are better for reallyreallylongnames - they make it a lot easier to find the start of words when skimming. CamelCase or camelCase is good for making names short, but useless when your names are already gigantic.
Admin
Probably in C#? In a posting about a "JAVA wizard"? Duh...
Admin
>> Captcha: awesomeness
Which is exactly what PHP and MS Access working together are... Yes, they *can* interact. Yes, there are library methods for doing so. (It might be easier than writing a script to pull everything from an Access db and put the data into a mySql db; I don't know, I did the latter, as it was a 1-time thing. The former is certainly more useful for ongoing access.)
>>
What you dind't use the nice MyODBC ? Install it, go to Access, select table, and done.
Admin
I agree, could just be
boolean allOkay = user.allOkay(permit);
or possbly boolean allOkay = this.checkPermissions(user, permit); sice the user object shouldn't know how to check its own permissions and a permit shouldn't know what a user is (maybe)..
Admin
Hm... functional code in VBA? I think not.
Admin
Heh heh heh heh! Amen!