- 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
Hasn't their "smart" Dba heard about storing values in the power of two's?
Then you could use BIT arithmetic to get the value you want.
Admin
Store hobby values in this fashion. 1 - Climbing 2 - Photography 4 - Dancing 8 - Fishing 16 - Hunting 32 - Killing Zombies
then store values as their SUMS. So for a person who love killing zombies and dancing. store 36 against his id.
I hope the current crop of programmers knows about this time-saving valuable technique.
Admin
Trying to capture something as open-ended as "hobbies" in a database is a fools errand. You could never cover every perverted thing people might be into. But you really don't need to. You might care is somebody is into photography (if you sell cameras), but who gives a shit if somebody is into medieval history? If you don't sell books on medieval history?
So just drop the "hobbies" thing altogether and just have a series of "rate your interest in this topic" questions for things that you can actually do something with. There are even subtler ways you might gauge interest in subjects without explicitly asking too. For example, if your website has pages on cameras and a user visits those, they are hinting that they are interested in cameras!
If you really must, include a free text field for other interests and then mine it for recurring words that might hint and other interests you can add later.
Admin
Great. Because we all know there are only 64-bits (or chose whatever limit your database supports) of hobbies out there.
Admin
Simple - store the bit field as a binary image blob that can expand to any number of bits!
Admin
Let management dictate the WHAT, let the dev develop the logical HOW, let the dba administer HOW the data which needs persisted is. This should indicate a close relation between dev and dba. (And contention with management.)
Admin
Yeah, and the way it was written was very anti-climactic, just kind of stopping. If all the hobbies are in a table, then... ah to hell with it. I mostly just come for the Hanzo stories myself.
TRWTF was the change order submitted in paper instead of in a change control system.
Admin
So fishing (0001) + fishing (0001) = photograpy (0010)
(I like fishing a lot)
Admin
Right on the money. I can't describe the despair when I heard of a manager in our organization who decided to use Hibernate because "that way, the developers don't even have to know SQL!"
Just guess which part of the application now causes the most problems for both the database and the application server.
CAPTCHA: dolor: I'll give you a dolor for every developer you hire that understands SQL.
Admin
Nein! Zis is KAOS!! Ve don't "CONTROL" here!!!
Admin
The "values-encoded-as-powers-of-2" trick? That's the third time I've fallen for that one this week!
Admin
I knew we were in trouble when I saw the table which has a name that starts with tbl_.
On the other hand. If there really are only 4 hobbies to choose from it might be a reasonable solution because it gives sales people a simple list to look at.
Admin
There's a finite, rather-small, limit to bit-masks. Why do we want to limit the number of hobbies that sales uses?
Disk space AND I/O are way too cheap today. We can easily fit a a table of hobbies and a (hidden) join-table for the many-to-many.
I think the real issue here is that it takes combinatorics to fill the DBA's hobbies list. Enumerate all "N choose I objects.", which is way larger than a sparse join table!
Admin
Admin
Now, that's control.
Admin
Reading Comprehension Fail #1 and #2:
Reading Comprehension Fail #3: All you guys missed this from the article: It is what the customer asked for, dumb as it may be.Admin
Admin
At least then, you'd have a photo of the one that got away!
Admin
"At least you'd have a picture of the one that got away!"
Feh! Stoopid magic mouse.
Admin
Yes, we're over protective. It's mainly because our systems are supposed to run at top performance, all the time. I know when one little thing runs 0.01 seconds too long I get called about it. Well, when you consistently introduce change in an environment like that, you lose consistent performance. Fact. We are overprotective because developers and the business are the first people to call "database" as an issue, not the fact their cursor inside a cursor inside a cursor doesn't scale well... well, it did against their 3 test records, it ran in 0.002 seconds...
Captcha: jumentum, This is my friend Bob, have jumentum yet?
Admin
This. Business logic (and reality) defines relationships between "things". Databases define relationships between tables. If the relationships defined in the database are not isomorphic to the relationships needed by business then it is usually the business logic that wins, requiring someone somewhere to reimplement a native database functionality outside of the database, as was done here.
Admin
Wrong bit for Killing Zombies. The Killing Zombies bit should be the SIGN bit. You got to be negative to kill the undead!
Admin
9 Profit
Admin
Now all we need is for Sales (who have asked for the authority) to decide to put in all the hobbies they can think of - after all what could go wrong.
(for those without the Math, their look up table has 2^N records for N hobbies - 100 hobbies equals a mere 1 million records, I bet they can get to more than that)
So in a bit we should get the new improved WTF from the hapless maintenance geek who is assigned the job of speeding it up.
Obligatory captcha comment: We who are about to die "saluto" you
Admin
Not to mention it's still working really hard to avoid the obvious solution. Yes there are "better" ways to do this table into one field thing, but it still doesn't explain why the obvious way should be avoided, especially in this case, where they made a new table for managing the combinations anyway.
You'd swear some DBA/programmers think new tables/fields come out of their paycheck.
Admin
It's not one of those things that's really good or really bad, but it can be helpful. TO say that it's a really bad idea is probably the worst approach that you can take to it.
Admin
+1
I can imagine the lead-up to the implementation of that architecture:
DBA: Here's an awesome many-to-many relationship setup for these tables. PHB: Why didn't you listen to us!?!??! We have a precise list of options that users can select! DBA: But this is more flexible, it will give you better data. PHB: We've had a focus group tell us what gives us better data! Implement this design right now! DBA: (dies a little inside with silent resignation)
Admin
It's not THE Network, it's just Network.
Glad I'm not the only one who noticed the coincidence of Luigi and a Martinet.
Admin
I gave up on that notion when I gave up programming in FORTRAN IV.
Admin
Or maybe they thing the tables are wooden. Won't somebody think of the trees!
Admin
I find that The Real WTF is that no one has mentioned "Normalization" at any point in this comments. :-(
"DBAs" who are anti-normalization? That's just wrong.
Admin
The app I admin does that. In a couple places.
I tried pointing out a few beginning dba efficiencies they could claim with a couple tiny changes, and got shut down.
So I try very hard not to need those fields in reports. And drink.
Admin
Wikipedia URLs are considered SPAM on this site?!?!?
How's that for a WTF?!?!?!?
Admin
"Yes", Luigi admitted. "There's nothing wrong with the change itself, but you need to reject things on a regular basis to show everyone you're in control."
Admin
Like a Ninja in the night, Jeff Grigg noticed that whenever he tried to post Wikipedia URLs to his favourite website "Worse Than Fail", they were marked as SPAM by the redoubtable akismet engine (aka SKYNET).
"This is why we can't have nice things in the comments" spat Gertrude, Jeff's dominatrix and bridge partner.
Jeff felt his temper flare. "Fuck you akismet!!!" he cried. While Jeff knew The Book of Five Rings told him there would be hardshipss as he fought dragons, monsters, and Nagesh, this latest pain was just too much.
Admin
Why you calling my name?
Admin
Simple solution is to look no farther than bigdata. Hadoop is best for such kind of flowing text words like hobbies.
Also bit based values are ok in C++ or C. In java it is simpler to go with Hibernate.
Admin
Fun fact: "akismet" is an acronym of "ska time."
Admin
Keep in mind a star schema would be a terrible choice for a transaction system. Buts its a great one for Analytical systems.
Admin
You've never met SysAdmins, then, right?
They can be just as paranoid and over-protective of their babies as DBAs. Moreso, sometimes, as the profession is a little older, so they've had more time to become entrenched.
If you're irreplaceable, you're also un-promoteable.
Admin
It seems to me like it is a combination of both. Instead of goofy idiots at the top like Idicracy, we have mean idiots instead, like Max Headroom.
Admin
That's my experience too. A DBA is responsible for administering a database - working out how to configure the instance, how to lay stuff out on disk, all the stuff for getting optimal performance out of it. But they have little or no knowledge of what the data actually represents, so they have no business doing schema design or any of the other jobs that developers are responsible for...
Admin
Fun fact: the word you're looking for is "anagram".
Admin
This is KAOS, Shtarker, not Chaos!
Admin
Fun fact: the word that that I was actually looking for was "caffeine"
Admin
It's funny how DBA is a well-known term, but DBD isn't.
Admin
Cuz they need help with the database design you did for them.
Admin
QFT. I bought my nephew a book on Oracle for his 13th birthday last week. He can already replace any DBA you're likely to meet. He ought to know, he's an expert, he told me himself.
Admin
DBD - isn't that Twiki's catchphrase?
Admin
I think some people do not get what their final "solution" looks like...
It is going to be
tbl_hobbylist int_id hobby_name 1 fishing 2 photography 3 climbing
tbl_customer int_id str_hobbyies 1 "1;2" 2 "2;3" 3 "1;2;3"
I have seen it before. It is a way to design around many-to-many relationships without having to have a separate table. It is also really bad database design, and obviously will not have any relational integrity. On the other hand, it is usually no problem to split and parse the string, especially in web programming languages.
Captcha: quis... Quis custodiet ipsos custodes?