Half-Penny For Your Thoughts

rounded down to the nearest cent



Categories


Recent Articles




Computing

Bah! Databases

Time for one of my ill-informed pet-peeves. As is probably obvious to anyone who reads this blog regularly (mostly because they probably know me), I find software design/development very interesting and like to ponder it. At the same time, I really don’t have a lot of expertise or experience in computer science / programming; it’s a hobby that occasionally brings in money. To the point, take this rant with a grain of salt.

What I’d like to know is why do so many programmers/software designers feel the need to duplicate databases. (I’ll admit, SQL is a bit of a pain as languages go, but then, SQL is just the interface; it can be replaced.) Basically, I’m sick of having to muddle through yet another plain text format. Sure, some configuration files justify a complex DSL, that’s understandable, but a lot of configuration and data files could be done just as well in a traditional database.

And I think that part of the problem is people interpreting as configuration that which is actually data. Take Bind for example. All those dns files: data. Stick them in a bloody database! Sure, I accept that it would be silly to use a database for basic configuration, but use a known standard, like yaml. Or, if you feel the need, even XML. (But why people use XML for key/value pairs, I do not understand). And then for generally accepted data, like emails, there’s these lovely (-ish) databases. Don’t stick 3000 emails in a flat text file. Stick them in a database.

What I want is power over my data. A database gives precisely that, including enabling sharing of data between applications. Now, yes, they’re are many file types that need a unique, custom solution. But I’d rather try it first with a database. Perhaps one of the difficulties is interface. It is much nicer to me, instead of using SQL all the time, to have a library (such as ActiveRecord) that creates objects based on the fields, etc. (and, in my wish list, includes doing automated validation, etc. based on the field constraints). Such interfaces aren’t always available, depending on the language and environment, but if I have to choose between setting up the interface to a database or to yet another not-quite-standard text file, I’d rather go with the database.

Really, for an object with well-defined fields, a database (or something like yaml) seems to me so much more elegant, and it’s already available. For a format that doesn’t have well-defined fields, but does have some structure, hey, that is what XML is great at (To me, the sad thing about XML is that it gets used so often for storing/sharing a set of well-defined fields that could be just as easily done in yaml, or even csv, but particular XML schemas often forbid the freeflow structure that it’s so great for. What’s with that?).

Grain of salt.