- 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
picks chin up off the floor
OMFG
Admin
Though of course, most tables in the example are truly bad, I don't necessarily think there is something wrong with having a unique id for every table.
Admin
Using this piece of crap as an excuse to mock those of us who believe in unique abstract id fields is a cheap shot.
So in return I will treat you to a pot-pourri of traditional WTF responses, sans typos.
My eyes! The goggles! They do nothing!
They should have used JavaScript.
The real WTF here is that they use pseudo Hungarian notation to name their tables.
I realize this is tangentially relevant but back when I was in college I had to write an operating system in FORTRAN to run on C64s.
The real WTF here is that they didn't CamelCase every word ("of" isn't capitalized).
Sincerely,
Gene Nixonko
I realize this is tangentially relevant but did you realize that Oracle has TWO varchar types? No wonder Larry Ellison owns a 454-ft yacht.
I bet this person was paid by the table row.
This looks like the work of a highly-paid consultant (tm).
I shudder to think of the VB front-end to this. Can you believe VB conditional evaluation doesn't short circuit until VB.NET?
MY EYES THE GOGGLES THEY DO NOTHING
FIRST!
[pi]
We all know the value of Yes is 42.
Admin
How could I forget!
[insert horrid mangled html]
Screw this forum software.
Why does the captcha always fail on the first try?
The real WTF here is this forum software.
Sincerely,
John Huckleberries
Admin
That certainly will make it easy to add 'File Not Found' to tBoolean.
Admin
That one is way past "WTF", it's an "Oh My Fucking God What Did I Do To You To Have This Thing Put In Front Of Me"...
Being able to THINK a DB that way is an amazing, nearly unreal, feat. By itself.
Admin
You know you've been reading TDWTF for awhile when you laugh out loud at "Gene Nixonko" :)
Admin
Foul! This WTF isn't really about the supposed evils of artificial keys; it's about retarded lookup tables and stunningly inappropriate field data types.
Admin
The only time I'll allow a table without a unique ID is when I'm making a pure lookup table, where the only thing in it is junk that'll be selected into drop boxes and crap like that, where the data will never ever change...Like a list of state abbreviations, or something.
Unique ID's, even if the data is just temp data, allow you to go the the exact data point that caused problems in a core dump, or allow you to update some seldom updated fields without a torturous WHERE clause. And they don't take much space, so whats the problem?
I don't know why anyone would bother with this crap though. I only work with timestamps, not numerical dates, so the only issue is making sure it outputs the date in the correct format. A simple conditional will take care of that, and apparently save me from having to put together a half dozen tables fulla crap.
Admin
I agree. The person is trying to mimic date fields rather then using built-in ones. It's not a matter of id fields being unnecessary, it's a matter of the tables themselves being unnecessary. But where the first part might be worthy of a weak WTF, the addition of the id field is hilarious.
BTW, other than Geneko always signing his posts like that is there an old joke where someone wrote "Nixonko"?
Admin
OK, here come some half-assed justifications for you to slam [:)]
tDayOfMonth: Semi-useful because one field gives you the leading zeroes and one doesn't. OK, yes I know that sort of thing should be done on the presentation layer. But having DayOfMonthID as IDENTITY instead of INT is a bit nutty, I will admit.
tYearNumber: No excuse for this, sorry.
tDecisionType: DecisionTypeID should be 0 and 1 to match real boolean values, but having Name and Dscp fields can be handy. For example, Dscp can be used for tool tip text, assuming that it's not exactly the same as Name like it is here.
tBoolean: I'll admit that I've done this. If you have a boolean field that you want to present as a dropdown*, you can use this table to populate the text and value. And, if someone in their infinite wisdom decides they want all dropdowns to say True or False instead, you only need to change it in one place. Admittedly, there will ever only be two values here so using a table is a bit overkill -- unless you add "2 - Maybe" [:P]
*I'm sure someone will argue that boolean fields should always be a chackbox. But what if the boolean field is nullable and you want "Yes", "No", and " " as dropdown values?
Admin
rogthefrog, your table of varchar values is missing an identity column.
I really enjoy seeing the use of varchar 50 to hold a 3 letter value. (yes, I know that it would not cause trouble here because the tables are *probably* of a fixed rowcount...)
Admin
Counterexample: Join tables. When all you need to do is relate ID's from two other tables (where the ID's are used correctly, naturally), you can put a uniqueness constraint on the two columns and there's no need for a third identifier, since your queries will likely be things like, "get me all relations for record N" and "are records M and N related?"
Admin
rogthefrog you used all the usual comments, so this thread will be rather short. I must say it was brillant.
Admin
The tYearNumber will certainly avoid Y2K and Y10K problems, with support for YearNumber up to the year (1 * 10^50) - 1:
or, the year 99,999,999,999,999,999,999,999,999,999,999,999,999,999,999,999,999
Admin
Damn. How the hell are we going to get to a curly brace style" or "My programming language vs. yours" flamewar from here?
Admin
<font size="6">O M G</font>
Admin
Wow talk about a straw man, this is not what ID table argument pushes and you know it. The WTF here has nothing to do with the ID columns, but the completely unecessary table themselves.
Admin
It's missing the tInt table.
IntID IntValue IntDesc
(INTEGER) (VARCHAR(50)) (VARCHAR(150))
1 1 One
2 2 Two
3 3 Three
...
2147483647 2147483647 Two billion one hundred forty-seven million four hundred eighty-three thousand six hundred forty-seven
I hate half-assed developers.
Admin
Admin
What are the odds that the database you are using stores those unique dates as longs? Even using a timestamp as your unique is not guaranteed to be unique. Personally I like to use either a GUID (also not guaranteed to be unique) or an incremental column. Both timestamps and GUIDs suffer from debugging issues since they are a pain to manually link up when reviewing the data in the database. An incremental id column makes that a lot easier.
Admin
First, I'll try to use Firefox to quote you and reply. When that doesn't work correctly, I will dis the forum software for being written in .NET.
Then, I will revile your use of quotes as being clearly incorrect, stupid. (Kay, your turn.)
Admin
First of all, I would like to second the straw man accusation.
As for this, I think you're wrong. I predict this will be the longest thread ever on TDWTF.
Besides, you all forgot
IsTrue("original post" == "straw man")
Admin
The wtf here is clearly only related to the use of identities.
Each of those table defs is extremely useful (or would be with the correct datatyping).
The 'boolean' is vital (perhaps not a great name) but really, you have to know the value of your bits. It is sometimes suprising how many people think 1 is true when clearly it is 0.
Tables of dates and at least as important tables of numbers are extremely useful - but only if you know what you are doing I suppose.
Admin
Brillant it is, but he forgot one thing - he didn't implement the isTrue() function for this thread.
Admin
I use Firefox to quote and reply and have no problems... (although once I say this I know it'll barf).
Admin
The Nixonko reference it to the dude that signs his posts as Richard Nixon, the inventor of Mayonnaise (I think)....
Admin
Maybe the SQL engine in question didn't have CASE or stringification operators... in which case the tDayOfMonth table could come in handy. It even zero-pads everything correctly.
Admin
Yeah, I'm not sure what the problem was. But I'm not gonna try it again.
Admin
You've been paying attention, but you have much to learn grasshopper. Both Richard Nixon and Gene Wirchenko sign their posts with "Sincerely". I'm starting to wonder if it's just the same guy with a split personality. Like Tyler Durden and... the uh.. other guy.
Admin
Let me guess, every table in this database that stores a date value probably does so via including the following:
DayofMonthID
MonthofYearID
YearID
I'm horrified to think that there might also be tables like:
tSecondofMinute
tMinuteofHour
tHourofDay
Admin
string result = "";
for (int i = 0; isTrue(i < 3); i++) {
result += i == 0 ? "Whiskey. " : i==1 ? "Tango. " : i ==2 ? "Foxtrot." : "File Not Found";
}
return result;
Admin
There are those pedants who proclaim absolutely that either all tables must have primary keys or the negation thereof, and then there are those who actually know how to design a relational database... :P
Admin
Actually, Richard just started doing it to mock Gene Wirchenko.
But yeah, back to the topic, identity fields suck. Just look at the example of how every artificial key advocate uses them!!!!
Admin
Somewhere along the way I remembered about the Gene Whatchamacallhim, but if that's all the significance of "Nixonko", then case closed.
Admin
They are missing a row on tBoolean. They need:
2 FileNotFound
.jc
Admin
How could you call yourselves developers??
The need to store the year, month AND day of month is for OPTIMIZATION!
Admin
Well ya know what I heard? That Gene's little sister started going out with Brian from the football team, and he was totally two-timing her with Richard Nixon's wife, unbeknownst to him, which led to this huge confrontation between Richard and Gene and yadda yadda yadda, now we have a sales tax on cigarettes.
Admin
don't forget the Char table tChar
CharID Char Value Char Desc
a a a
b b b
. . .
. . .
blank
we need specify the blank char!
Admin
Gosh damn it! That's why I'm paying more and more for cigarettes?
I hear Gene's little sister is hot though. However, Richard's wife is an unfortunate looking woman.
Admin
I think you mean, "I suspect Richard just started doing it to mock Gene Wirchenko.".
Sincerely,
Richard Gene Nixon-Wirchenko
Admin
I very much doubt that this is what the idiot had in mind, but a table of fiscal years actually makes sense. Even VARCHAR is occasionally useful when a business decides to change from one scheme to another, e.g.
FY2005 = 7/1/04 - 6/30/05, prior fiscal years similar
FY2006 = 1/1/06 - 12/31/06, subsequent fiscal years similar
You can extend FY2005, but that throws off a lot of year-to-year and period-to-period comparisons. Alternatively, you can define FY2005B = 7/1/05 - 12/31/05.
Admin
I really hope that this is a joke, and that my sarcasm meter was off taking this seriously...
Admin
Nah, they'll create a tDate table containing DayofMonthID, MonthofYearID, YearID and of course, DateID since all tables must have a unique identifier.
Admin
Each day I use a piece of crappy work to mock those who believe in some crappy and incorrect software development practice. Today is no different.
I strongly encourage those who might agree with such a design to take the time to learn before doing. Relational databases are in a fundamentally different world than procedural programming; trying to apply such principles through self-teaching is a recipe for disaster.
Admin
Why has it taken me more 1 minute to realize how Freudian inventing Mayonnaise is?
Admin
Nah, I'm pretty sure:
http://www.thedailywtf.com/forums/47011/ShowPost.aspx#47024
Admin
Two more straw man arguments in the same post.
Admin
My bits are quite valuable to me, but that doesn't mean it's a "yes or no" thing. I mean, if someone was going to take my life or my bits, I would have to make a judgement there; and if all I've got is "true" meaning "Yes, I value my bits," then I've got no context for making the decision between life and bits. Furthermore, I could never instruct a computer to make the same choice for me, other than to make random choice between everything that has a value of 'true'.
That's why every table should have a unique 'SortOrder' column.
Admin
How Freudian is it?
BTW, are you Paula of PaulaBean fame?