- 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
private System.Windows.Forms.ComboBox _cb_FR_ist
Admin
I'm going to partly defend this.
I work with a few dozen Winforms, and at some stage they all degenerate into a confusion of naming conventions (usually label1 rather than button1, because who cares about naming a label?). It's actually pretty rare that I care about naming a control, because, guess what, Visual Studio has a little window that tells you the properties, which is really all you need. Use the power of the Designer, young Jedi!
I wouldn't be exactly happy if I had to work with this thing, but in practice I'd just rename the controls that actually have meaning to me, and leave the rest alone. Luckily Visual Studio refactors that renaming for me, as well.
Mind you, I'd question the sanity of the person who came up with the naming scheme in the first place...
Admin
Having said that, I'll bet the event handlers are a peach. I envision something like _CB_LPVB_K_EM3_U, which of course would be the Event for when a button on the Mouse is Up. The particular mouse button is indicated by the number, and three would be left, right, or middle, depending upon the taste (?) of the author.
Admin
I mostly agree, especially since you would never ever need to touch most labels in code anyway.
For fields its another matter as you usually do want to use them.
But I find that with age comes wisdom and my naming of things today is leagues better than 20 years ago ;) After going back to old code enough times you do learn the value of naming things good to start with.
Admin
Yeah, agreed.
Although this looks to me like the programmer might be pulling the name property out and parsing it with lumps of code acting on groups of controls according to whether or not they have the right hieroglyphics in the name. That, could of course, be a horrible inner platform mess (yep, seen it, with name and or tag or other properties) or it might be a reasonably neat solution.
Using decent names rather cryptic little codes would be better, but if it's done consistently I'd actually prefer this to camel case essays inconsistently describing UI controls, where you have to scroll across three screen widths of blither to spot a small difference in name. As you say, using pretty much any designer from the last ten years renders all that irrelevant anyway.
Admin
Nothing to see here, move right along.
Another slow day at TheDailyWTF.com
Admin
That is the true WTF here. The fact we are so used to this we don't even care.
Admin
It's just Remy warming usup for Tedious Twaddle Thursday
Admin
As long as it doesn't inspire someone to come out with that tired old fascist bullshit that healthcare is a privilege not a right, and because only 7.8% of Americans need multiple jobs just to exist, then there's no problem with the world, then we should get past that mostly unscathed.
Admin
Oh don't get him going again, even I got bored in the end. Mind you, it was still more entertaining and relevant to TDWTF than that inconsequential fart-fest about Basecamp.
Admin
Another logical defense is that the field names correspond to the fields in a database. That makes binding the field to the db much easier.
Admin
It just pushes the problem back a level. Who named the database fields so horribly?
Addendum 2021-05-19 09:34: EDIT: columns not fields. Sorry CELKO
Admin
Remy can you delete Prime Mover's out of place political comment above?
Admin
Guys... it's reader-submitted content. They can only work with what they're given. Lay off, alright?
Admin
FWIW I wouldn't mind this set of names, so long as there is a scrupulously-maintained set of documentation stored with the source code which defines each field within the naming structure.
You can find an example of what I'm thinking of on lots of data sheets for electronic parts or mechanical assemblies, where there's a table explaining what each subfield identifies and the meaning of each value for that field.
Admin
So you think that a button called "button1" is acceptable in any production code? Well, that and its friends numbered (with some gaps) up to 33?
Admin
I'd agree with that, in general, except that "Gormo" specifically states that these names are incomprehensible. Which they certainly wouldn't be, if there were data sheets around.
Further to that, let's just "parse" the combo boxes for LPVB. Perhaps LPVB is in the data sheet. I doubt that, say, K[/B} would be -- it would be an abbreviation for some property of the [B]LPVB[/B} widget. So, let's stipulate melting point or something in Kelvin ... you'd still prefer to see [B]_CB_LPVB_MeltingPoint.
Some parts of mapping names to the business domain make sense. Other parts ... don't.
Admin
No, that part shouldn't be there. I would have "hoped" that all those items are dummies with no current effect or use, and only seen in the development branch. Like I wrote, ... only if all names were fully documented.
Admin
To be fair, even "Button1" documented properly is better than SubmittedDocumentDocumentObjectSetFocusUnfocusPropertyCommitRejectConsent which turns out to just work like a form cancel ... naming stuff, in it's various forms, seems to be a big part of WTFs, so much so I never assume the name of a method/object/variable is even vaguely descriptive.
Admin
Your comment seemed to trigger a snowflake into demanding his safe space be enforced, but this isn't Parler. Please post to confirm you haven't been censored!
Admin
"I got bored" is euphemism for "I lost", and I just wanted to keep the politics from spreading everywhere; numerous users here asked to keep politics out of these software discussions. We devoted that previous article's comment section to some policy back and forth (which you lost); going forward, let's stick to discussing the software topic at hand.
Please don't respond here; we can use that article's comments, or perhaps some other medium, to discuss politics/society/policy/any other topics. I'm at your service, I can whoop your ass in any topic of your liking.
Admin
Not really, debating with you is a one way stream. You only "won" if you persuaded me you were right, as oppose to just being an arrogant prick. You might perceive yourself as having "whooped my ass", I'll leave others to judge that, because I thought you had a point, but not a very good one, and you argued it in a fairly mediocre way.
Admin
I wrote, "please don't respond here", mostly to respect others' wishes. But you don't care about either my request or others' wishes.
How did you put it? "Arrogant prick" - sounds about right.
Admin
"Arrogant prick"
I'm fine with it. Let's see what others think. You better start setting up some shill accounts to argue your point further as I think you are in a corner now.
Admin
Been there, done that. The weirdest thing is that after a few years of names like these they actually start MAKING SENSE and you can figure out even those that you've never seen before. O_O I think that's a sign that you've stared into the Abyss for a bit too long...
Admin
"shill accounts", "in a corner"? Man you crazy, not just mean and a debate loser.
Admin
Is the best you can do? honestly, I'm disappointed ... I thought you might have have had a point, obviously not.
Admin
Oh. So a Gauleiter-wannabe like Prime Mover wants people fired for daring to disagree with his political diktats - no problem. But someone asks for one comment of his to be removed, where there are no lack of other forums where he could let his inner Nazi hang out (heck, he could do it in the previous thread), and you cry censorship. Get bent.
Admin
I now return us to our regularly scheduled rant about IT and this steaming pile of winsome WinForm WTFery.
I sorted the code snip to get a grip on what the heck it contains.
59
Button
s. 2 w sensible names, 31 w the cryptic abbrev_abrev_abbrev pattern, and 26 automatically namedbutton##
ranging from 1 to 33.17
CheckBox
es. All 17 have the cryptic names, but one has a different syntax from everything else on the form.40
ComboBox
es. All 40 have the cryptic names, but two have a different syntax from everything else on the form.1, count it, one
GroupBox
probably to try to collect/connect some of theRadioButtons
discussed below.4
Label
s. 1 has the cryptic name, 3 have auto-numberedlabel##
names. But they're 1, 13, & 18. Where are the rest? Darn good question.1
ListBox
with a cryptic name.1 , count it, one
Panel
with a cryptic name to try to organize this amazing agglomeration of controls.2
PictureBox
es with autogenerated names. Like in Calvinball or FizzBin, here's where they slip in a bit of actual consistent organization to fool the people who began to believe the whole thing was a put-up job. Their names?PictureBox1
andPictureBox2
, exactly what you'd expect. If you weren't already made insane by the rest.4
RadioButton
s. Two named sorta-sensibly and two in the cryptic pattern. But with only oneGroupBox
on the page, how do they interact?1, yep, one
ToolTip
with the nice autogenerated nametoolTip1
. Helping the user understand this dog's breakfast is obviously a high priority for the "dev" (and I use the term loosely) who created this.With this inventory what do we learn? Not counting the radiobuttons that are hard to score, there are 59 + 40 + 17 + 1 = 117 opportunities to make inputs on this form. And 4 labels and 1 tooltip to explain what goes where.
Even if this is only a partial except of the actual designer generated code, 117 inputs on one form is ... Not Right.
Admin
Just had an awful thought. What if this is actually several forms in one, where most of those 117 inputs will be hidden, depending on what state or mode we're currently in?
Admin
With this attention to detail, sir, you are hired!!
Admin
While there are obvious problems here I think this is an overreaction.
If I need to actually interact with a control I give it a meaningful name. However, labels rarely need to be interacted with and plenty of buttons don't need to be interacted with (example, the cancel button always cancels, period. You put the "Cancel" on the button and point it at the code that cancels, but you never actually interact with the button in your code--it's probably going to be button##. However, I frequently disable the execute button until the state is suitable to execute, now there's some OnChange code that must enable it and thus it gets a meaningful name.)
As for WTFGuys's comment about Label1, Label13, and Label18--the form has probably undergone some changes over the years. I've had plenty of cases where the autogenerated numbers are not sequential even without a form evolving. I normally give a meaningful name to a control when I first write a piece of code that actually refers to it.
Admin
RE: The "Your company's app" comment:
To be fair, Apple and Google are doing a completely different job there. Try signing up for a Google or Apple account and see what that UI looks like.
Admin
As I'm not Prime Mover and don't really agree with him on that this bit of whataboutism is a waste of electrons.
Admin
Wasn't there a recent TDWTF that was exactly this, only longer?
Admin
I actually was censored a little bit. Mr. TA replied "Shut up" and I replied to him "I thought you were all in favour of free speech."##
Both posts appear to have been deleted.
Admin
That is what we common folk call a hint. And you might want to "get" it.
Admin
They are private - any good Winforms developer would be using MVP (Model-View-Presenter) and those names don't matter a fig at that point as long as the IView has decent names.
Admin
The bigger problem with this code - seems there's not many good winforms developers here (although surprised others haven't picked up on it) is that there are way too many controls and from the naming you can see they should have been made into their custom controls. Seen this so many times in business code where unqualified, self taught VB.Net "developers" create abominations such as this.....
Admin
Custom controlls don't always make sense. And they introduce another layer of fiddly that you now have to budget for and maintain. At least if you want to do them right and not just move the abominable code out of sight.