Database Rant #1

Why is it that every time I see a database it’s fucked up in some way or another?  Probably I only notice databases when they are screwed up.  Like a well-designed and maintained machine, databases are invisible when they are working well and I don’t have to pay attention to them.  But I keep seeing a lot of damned databases, and (if you couldn’t tell) it doesn’t make me happy.

It seems to be no coincidence that the majority of the (um) “issues” on The Daily WTF involve databases and their mismanagement.  Speak not to me of data being in the wrong normal form or needing more indexing or of foreign key kung-fu.  Sins at these levels appear to be far, far beyond the skills of the everyday database codermonkey.  Most screwed-up-ness is at the level of aggregative complexity, or less technically, “We got here by piling a bunch of new crap on top of a lot of old crap and every Large Engineer we’ve hired to help us out of the mess has made weird signs with their fingers and run away (sometimes screaming).”

I swear to God that Oracle should be renamed Cthulhu, Eater of Data and Consumer of Programmer Souls, but I might be over-reacting; you can commit crimes against humanity in nearly any database code.

Look, people: A database is a responsibility, it is a burden that you are going to suffer as long as the data is important to you.  If you just toss in data and relationships and stir you’re going to wind up with grey muck that looks it wants to eat New York again.  If you stick a lot of stored procedures in there you’re going to have a bunch of stateful shit happening every time you touch something, and that stuff is very nearly undebuggable.  If you shoot yourself in the foot, it hurts.  Stop making systems that hurt you.  Is that so bloody hard, or do you like having your pager go off at O-Dark-thirty with yet another screwed up inner-whatsis-join-procedure bug?

Rule #1 is therefore: Thou shalt not make your schema too fucking complex to understand.

Rule #2 follows quickly: Thou shalt make your database accesses ditto.  Stop spreading them everywhere.  No sneaking updates or queries into a zillion different places in your application.  In other words, actually spend some time to design.

Once upon a time I was working on a database-centric application, an exploratory rewrite of a horror that shall remain (as good horrors should) nameless.  Maybe a month into the design process the marketing drones in this company got wind that we were doing an investigation into replacing the current Deployment Nightmare from Hell, and one of them came up to me and asked, “What database is the new stuff going to use?”

Now, I could have claimed ignorance, but I knew quite well what they were asking, and shivers went down my spine.  They didn’t care what the schema looked like, or what kind of abstractions we were building in order that we wouldn’t accidentally couple to a particular data access engine.  They were asking if we planned to use Oracle or SQL Server.

I accidentally told the truth.  I told the marketing drone, “It doesn’t matter, the new access layers will talk to anything, so we can run on anything” and to their ears this meant “We don’t know what the fuck we’re doing, we don’t even know how to spell the word ‘Database,’ how about that?”  It didn’t matter that they were doing the equivalent of asking someone who was about to embark on a long road trip what brand of gasoline they were going to use.  The marketing folks didn’t understand that database engines are supposed to be a commodity . . . and that projects that targeted to the features of a specific vendor are usually the ones to run into quality problems (which the old product had in double handfuls).

Anyway, the marketeers panicked clear up to the CEO (okay, in a small company this is only a couple doors down the hallway, but still) and I got called on a the carpet a little and had to clarify, “Sure!  We’ll work on Oracle!” and then shut my trap (instead of continuing with “and SQL Server!  And MySQL!  And a Goddamned flat file encoded in Klingon EBCDIC if you have a stupid ODBC driver for it.”)  You’d think that the marketing drones were getting kickbacks for buying copies of Oracle or something.

Huh.

(There was a $200K piece of software on a shelf in the Dead Computer Room; some kind of enterprisey control sales site management blahdiddity package that this company, a start-up, had bought and that the shrink-wrap had never come off of.  What a waste).

Rule #0 remains: Stop hurting yourself with bad decisions.  No, really, just stop right there, take your fingers away from the mouse and keyboard, maybe even shut down your workstation for a couple of hours.  Sit there and think.  Doodle on some paper.  If someone comes by and wonders what you’re doing, mumble something about Bayes-Yegga threat analysis or something.  Your time spent staring at a blank screen will be well-rewarded (at least your fingers won’t be doing any actual damage…).

Book Queue

A smattering of books (not exhaustive). 

I’m still finishing up Stephenson’s The Confusion, soon on to the third book in this trilogy.  It’s been a long slog.  Guess what?  In the last half of the second book, things start to get rolling, mostly.  Fifty pages to go.

Generally I don’t like to read the first book in a series (some readers may remember Philip Jose Farmer’s Riverworld saga, which took fifteen years, three or four more books and several truckloads of deux ex machina and some truly crappy projection of computer technology to finally finish off).  I make exceptions for certain authors, and Lois McMaster Bujold is one of these.  Her latest The Sharing Knife: Beguilement is a fine example of professional fantasy writing; every paragraph seems to be doing two different things, the characters are believable, and the plot seems air-tight so far.  At this point (halfway through) I don’t really care that there are more books in the series, as long as it doesn’t turn into another Treadmill.  Recommended.

I’ve also been wading through all of the Miles Vorkosigian books by Bujold.  It’s starting to get old at the 2/3rds mark (with Mirror Dance), but it’s still good.

Adam Stempel’s The Singer of Souls is . . . not that great.  I really liked the first seven-eighths of this light fantasy, and was having a lot of fun with it.  The characterization is good, and while the plot is predictable, the characters make it enjoyable.  It’s a stretch to compare it to Emma Bull’s War for the Oaks, but the similarities are there (so are a few forgivable issues, such as filling out the motivation for some of the minor characters).  But it was like theatre popcorn; eventually you reach the end, and you might not want to swallow what’s down there.  The problem is that the last couple of chapters of this book completely destroy all of the preceeding work.  I’ve only seen a couple of books end like this (the deux ex machina wrap-up of Varley’s The Ophiuci Hotline comes to mind).  It’s just too bad.  I can’t recommend this.  I’m hoping that Stempel does a better job with his next book (he should get a better editor, for sure).

Oh yes, and it turns out that Russell Hoban (of Pilgerman fame) wrote the lovely children’s book Bread and Jam for Francis, which had me chuckling away the other morning with our toddler.

Hang up your phone and drive

Today’s million dollar product safety idea:

A BlueTooth interface from your cell phone to your car that lets you operate the turn signals with buttons on the handset.  Never be too busy to signal lane changes again!

Not that anyone would bother signalling anyway.

(Actually, I was really thinking about: A BT interface that, when you receive a call in your car and the vehicle is in motion, causes your phone to generate a high-voltage shock, forcing you to drop it on the floor to be crushed by the rotating knives located down there for just such a purpose).

Also: A sign that lights up on the side of your car with the words:

I HAVE RECEIVED XX CALLS TELLING ME I AM AN IDIOT
CALL ME AT XXX-XXX-XXXX

whereupon your car just shuts down (unlockable by a patrol officer) at some threshold of “You’re a moron” calls.

Everybody’s more important (than the user)

After reading this post on pollution of the Windows icon tray by every Tom, Dick and Harry program in the world (Creative, are you listening?) I had to make up a list of the wacky and fun things that people think installers and applications should do.

  • The video card manufacturer who thought it would be okay to hijack “control-shift-T” to launch their configuration program.  (I use this key combo in Emacs to manipulate HTML tags).  Sheesh.
  • The sound card driver that opened several windows on startup, including a volume control and a link to the manufacturer’s web site for support.
  • Umpteen zillion desktop icons installed by yet another sound card driver.
  • Yes, I know I have a wireless adapter in my laptop.  No, I don’t need to be constantly reminded that the network is connected / the network isn’t connected / wups the network is connected again.  Balloon notifications suck.
  • Oh, someone did some typing in an IM window?  Please make sure my concentration is interrupted by a blinking red notification for every single sentence that they type.  Thank you.  I am but a slave to the tools I sometimes want to use for communication.
  • My desktop icons need re-arranging?  [cancel]  Apparently my desktop icons need to be reblorkified.  [cancel]  I want to thrash the person who thought this was important enough to interrupt me for.  [cancel cancel cancel]
  • I’m sorry, I was a moron for plugging that USB device into a different port from last time, causing your driver to choke itself and ask to be installed again, just like the last time I plugged that thing into a different port.  How ’bout I simply toss the stupid thing into the junkbox next to the Creative Labs sound cards whose drivers and ancillary software can only be described as majestic in their hideous, cravenly stupid design.

To all: The fact that I boot my WinXP machine, and before I get into the DOS prompt something is chewing up 400 to 500 megabytes of memory.  I’m not doing any work yet and half the RAM in my system is gone.  Meh.

Out and aboat

We’re headed home on I-5 north of Seattle, and we see a used boat dealership.  It’s huge.  Literally acres of boats alongside the frontage road, some looking pretty good, some looking like they might have held water once, but that was maybe before the Vikings abandoned them on the shores of Leif Ericson’s land for new models.

“Boat,” the toddler observes.

He thinks about it a little more.

“Boat,” he adds.

“Boat.”

“Boat.”

“Boat.”

This goes on for a while (acres and acres…).  Finally we pass the lot.

“Okay,” I ask, “How many boats was that?”

The toddler thinks about it.

“Two.”

If he had been counting the ones that would still float, I think he might have been right.

 

blah blah blah

Micro-rant: In the does-it-irritate-you-as-much-as-it-irritates-me? department: The geeks that over-use the “open” and “close” forms of HTML and XML in common writing and conversation.  Hand-wavy quotes-in-the-air were bad enough, but this syntactic bracketing makes me want to run a consistency checker on the rest of what they say.

Next on the list: Bozos who hyphenate too much….