- 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 probably a container of some sort, perhaps a "section" - thin border with the title in top left corner - the Text property is the title and disabling it disables all the controls inside of it.
Admin
I think you mean a fieldset, not a section.
Admin
This really looks like it ought to be inside a looping construct that iterates though the collection of widgets looking for the one whose text is "Original"/"Originale". Or is a separate method called from a looping construct.
After all, very few UI objects are actually named "item". that just screams "output of iterator" to me.
Admin
FreeBSDGuy? Is BSDGuy in jail or something? Why do we need to free him?
Admin
I profess I don't get how people write code like this, the logic is very clear that all roads lead to false, so why keep the useless code? Perhaps they were paid by the line?
Admin
It always annoys me when people put parentheses around simple conditions in VB If statements. You are not writing C: use the idioms of the language you're using.
Admin
The nested
if
s mean it's not always going to disable it. It's equivalent toAdmin
FreeBSDGuy from chroot jail!
Admin
I will give the original author some internet points for thinking about future extensibility when they added that Else block. Surely, French is the only weird language out there, so if we ever need to support any others, they will use the word "Original" for this.
Admin
I always used parens in VB, never did VB.NET, I tend to put them in Ruby as well; which all the rubists hate.
I like them though it makes it a lot easier to visually reason about any compound conditionals, and avoids a lot of operator precedence questions. Should you know how to evaluate precedence in the language you are using yes; but honestly even the best of us can get tripped if are in a role that has us frequently switching languages.
It makes more sense to use them most of the time to me than it does to use them just some of the time. The exception I think should be for a single value, treated as a boolean, 'if (x.nil?)' does look kinda stupid
Admin
Not equivalent. Your code got the "else" relations wrong. In particular, if gLang = "fr" and item.Text.Equals ("Original"), your code would set it to False whereas the original (pun intended) code wouldn't (correctly).
Always nice to the when WTFiness of code can still be improved in the comments. In this spirit, I'd like to propose adding the following to cover German too (and make it more WTF-idiomatic, as per Jason Stringify's comment):
Admin
Until it is realized that "somewhere" there is obscure code that will item.Text = "Copy" and that edit broke that use case...
Admin
I've sold this application to an German company, and promised a full translation. Delivery date is the first of next month.
Admin
If you do it wronglyworthy, do it right: If ((item.Text.Equals("Original")) = (not (False))) Then. Or else.
Admin
He's in jail(8), not jail, so all OK.
Admin
Because he was malloc'd.
Admin
I'm sure we can do something nice with
map
andzip
if we had all the translations in a dict.(And I know – and have occasionally been – the kind of programmer that goes "there's tutorials for i18n, so obviously that's complicated, I'm at maximum depth of my mental call stack anyway, I'll just cobble something up". Which is why you should have enough non-billable time to identify(!) and fix technical debt.)
Admin
Re the comment about "label doesn't allow editing", that's true, but Enabled still has a meaning for labels. It will change the UI to make it gray to give a visual cue that the associated item isn't active.