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.


Computing

To believe in SQL

Comment from the Ruby on Rails blog:

John Griffiths on 30 Nov 17:23:

There are currently two things I really believe in right now, SQL and Web 2.0.

He goes on to say about Ruby on Rails:

it’s like PHP on ACID!

Okay, quoting that second snippet was purely gratuitous on my part.

I was about to write about something else, but then I read this. I suppose my first reaction was along the lines of Help us all if SQL is one of the two things left to believe in. Of course, that would have been before I saw that Web 2.0 was the second. Incidentally, no, I don’t think he meant the word believe in the way I just took it. But the fact that I initially read it that way is why I’m blogging about it.

Wait, why am I blogging about it?

Oh, right. I think it’s that SQL is something that can be “believed” in. I do like SQL because it is a roughly standardized language for interacting with all sorts of databases…in theory…anyway, more standarized anyway than, say, javascript. And the sad thing is that that level of standardization is to be so admired, especially when the standard is insane. Yes, yes, okay, making it roughly english maybe makes it easier for it to sent as a stream of text, but I think we can safely jump off that train now…please…it’s 200-friggin-6. Dagnab string of bytes…

I’m rambling.

I would like to see a lower-level standard for interacting with databases, that has nothing to do with writing english statements, but which each language could use in the way that best fit that language. And, yes, SQL could be one of those languages. And that standard could let the db specify validation rules such that the db-interacting library (a la ActiveRecord) could use those validations instead of requiring the programmer to define them in the model or elsewhere. Also, relationships between tables…

Of course, those are just my momentarily rambling thoughts…