- 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
Apparently there are no longer any cardinal rules in database design.
Admin
14:00 UTC and there's only one comment? AND IT'S MINE? . . . is my name Beverly Crusher?
Admin
To what lengths won't people go to in order to make code error-prone and hard to read? It's been 25 years since Visual Studio has allowed a developer that insists on using ADO.Net directly to make a subclass of DataSet that has strongly typed tables and columns. And it has a visual designer!
Admin
How is this a WTF exactly? An unnecessary ToString, and a repeat of the somewhat bad code? The only real thing here is using magic numbers rather than table/column callouts, really scraping the bottom of the barrel here...
Admin
Yeah, first thing I thought of: Why TF would you modify a table and put a column in front of any existing columns?
It amazes me how these people still have jobs.
Admin
This is likely irrelevant (but might be). It would matter what order the columns were defined in if the data was queried with "SELECT *". However, if the query was written as "SELECT col1, col2...", then the order of definition wouldn't matter. Regardless of the likelihood of the author of this WTF also making that error, we see no evidence of it.
Admin
Duly noted.
However, if the query is "SELECT * FROM", then the column was inserted at the beginning of the table, and that's wrong.
If the query is "SELECT col1, col2 ...", then the developer inserted the new column at the beginning of the query, with no regard for how it is consumed.
In both cases, there's a lot of WTF. One might argue it's WTWTF.
Admin
TRWTF would be relying on a specific order of the columns in a table.
Admin
Nitpick: Using names rather than positions has a considerable performance implication. In a case like this it won't matter (the adds to the boxes are certainly going to be even slower), but when I needed to load a whole bunch of children I got like a 3x speedup (actually higher, as my timing included the parents and some rendering) from looking up the index of the name at the start, then using the number to actually read the data.
Admin
The code accesses columns by index. That's already a blatant disregard for how the results are consumed. ORMs are good at starting with strong typing and then figuring out a compatible query, but the only sane way to program in the modern world is to strongly type any result that come from a database with an actual schema.
I can't tell you how many times I have to respond to "Well, the world didn't blow up when we did it thirty years ago." I constantly have to remind them that we now occupy a word where frameworks and dependencies introduce breaking changes at such an alarming rate that without several layers of defense, it will consume you.
Admin
FTFY
Admin
First, it looks like someone did a search-replace to add the end part to each case. Second, using a case will prevent errors if someone changes the table name, or perhaps they have an 'archive' table with the same data that can also be read by this function (still would be nice to pass the table name in, but this is probably very old. From a time where people giving asp.net courses claimed that Javascript would be gone within a few years because code-behind would do everything... yeah.. really)
"We can see that once, this exception handler displayed a message box, but that has since been commented out, presumably because there are a lot of nulls and the number of message boxes the users had to click through were cumbersome. "
I personally think it was a debug mechanism. And the found all the issues in the database, fixed them, and thought it would no longer be necessary.
Admin
There are so many WTFs here it's hard to pick which is TRWTF
Edit Admin
I'm curious about this reference. Beverly Crusher was the ship's doctor on Star Trek: The Next Generation, but was she known for being the only person to leave a comment on online articles?
Edit Admin
She was known for her "impactful comments and insightful observations", according to Google's AI. These "cementer per place as a beloved and respected character in the Star Trek universe."
That's all I got.
Addendum 2025-08-08 14:41: EDIT: "These cemented her place ..."
Edit Admin
My guess is someone wanted a string from the various fields but Item(x) returns an object so they weren't getting intellisense, But ToString() gives the proper intellisense (though you should really cast to string... but this ia VB.NET and IIRC casts are ugly there, not that that's a reason to prefer ToString, it's a reason to prefer C#). Then with the proper intellisense they could find and use Trim().
But then they realized they needed the text in uppercase. So they added ToUpper() but accidentally in the wrong place. But this is VB.NET which is ugly so it worked, and the dev ddin't notice.