- 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
Quite common, but also easily remediated (once one has done it a few time), there even are (were?) some automated tools that could clear up a lot of these default naming issues with decent heuristics. LTI [lest than ideal] sure, but not even close to WTF.
Admin
I remember doing similar things many years ago with Visual C++ and MFC with its Class Wizard. My colleagues and I did give our controls sensible names though because obviously we wanted to read each other's code!
Admin
And the code shows another special feature of old VB6: the default property. In case of the
CheckBox
, it is theChecked
property.Admin
The UI designer is a good idea, it exists in other frameworks, too (such as WinForms and WPF). If only it would prompt for the name of the control upon creation, to prevent all this checkBox11 crap.
Admin
That brings me back. I remember naming my variables 'poo' back when I was first learned to code in middle school.
Admin
Ahhh, the (bad) memories.
I think I've posted before about the line of VB6 code something like:
Btn21.visible = true 'false 'true
where "'" starts a comment. Not only did they use a useless name, and they used the "beat your code until it works" technique, they were careful to preserve the previous code just in case. Just in case they couldn't figure out the old value where it can only be "true" or "false".
Admin
Who knows, maybe they stand for:
Admin
In out codebase you'll find things like
where successive P's mean "prime" as in "derivative". It makes sense in the problem domain (x is conventional too) and is documented in comments.
I suspect that something similar was going on with p, po, poo, but at least it should be documented.
Admin
"I understand it doesn't scale to complicated applications..."
It certainly scales better than writing it all by hand and ending up with a big complicated mess of spaghetti code. Even in a complicated app, the UI designer will help with the mundane stuff.
Of course, as this article proves, you can still get shit code using the designer. But at least it's limited to the event handler code and not all the boilerplate code that creates UI widgets and hooks up event handlers.
Admin
A name prompt would be good (Visual Studio still doesn't do this!) but allow a default. Most of the time it doesn't matter what a label is called because it will never be referred to. I end up with a decent number of panels that likewise are never referred to--they just need to exist to make resizing the form work smoothly.
Admin
Yeah, I'm sure that PoS was definitely a gold piece.
Admin
Years ago I got handed a lump of VB code that provided a GUI front-end for some medical machinery. It was really just a grid of buttons dumped into a window, so barely counted as GUI, but let's get to work... OK, first thing is to undo the random tab order of the buttons and get them in logical order, which apparently astounded the original devs when they found out that focus wasn't supposed to jump randomly around the button grid every time you hit tab.
Then we'll rearrange them in workflow order... and remove about half the buttons that aren't needed and put a lot of the rest in a combobox... and add some labels... about two days' work later it had gone from a prizewinning candidate at that site where you submitted bad UI to to something that was actually usable.