March 9th, 2017 -- by Bacchus
Future-Proofing And Human-Proofing Your Databases
This is old, but the deeper you read into the 2008 essay Gay marriage: the database engineering perspective, the more profound it gets:
The real question from my perspective is how you store a marriage in a computer. Altering your database schema to accommodate gay marriage can be easy or difficult depending on how smart you were when you originally set up your system to accommodate heterosexuality only. Let’s begin…
I fell off the hay-wagon about half-way through the ride due to inadequate comprehension of mathematics and databases, but it was still worth my time. It might be worth yours too.
This entry was posted on Thursday, March 9th, 2017 at 12:28 pm. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.
Shorter URL for sharing: https://www.erosblog.com/?p=18350
Shorter URL for sharing: https://www.erosblog.com/?p=18350
I _am_ a database designer, and none of those examples make much sense. You need a “People” table that contains all of the information about any individual, and a “Families” database to account for the tendency of “People” to associate with each other. “Gender” is one entry in the People table, and when I designed mine, it had two possibilities; “M” or “F”. It would be easy to add other “Gender” options, except that I would have had to change the Gender field from a single character to perhaps 4 or 5 characters, to allow for the fluid and sometimes non-sensical values for “gender”.
EVERY person has an entry in the People table, and EVERY person has a linked entry to the Families table. It’s possible that a Family has only one person. That’s fine. If two people marry, then we move Person #2’s entry to link to Person #1’s Family table. If a third person joins the relationship, by birth, adoption or marriage, we link that person to the Family table. Divorce? Create a new Family entry and link each one of the People to the applicable Family entry.
Easy-peasy!
I currently have a bit of rather sophisticated computer technology implanted within my body, which communicates with other computer technology located outside of my body. I don’t currently consider myself cybernetic, but if I live long enough and acquire more machinery, someday I may, or at least others in the future may well have cybernetic partners. Someone should prepare databases to accommodate them. My guess is someday we may have interchangeable sex organs. Will we need to continually update our gender?
If we survive long enough to take significant control of our genome, we might be able to express multiple genders at the same time. I think at some point we may need multiple tick boxes.
Whiplash, Justin, my own (possibly Utopian) view is that gender as a trait will become something viewed as not important or practical to track by database, much the way religion is becoming in civilized jurisdictions now. Consider the parallels — it’s just another attribute that is self reported (there’s no objective external test for religion or gender) and no defensible reason for any third party to vary their treatment of you based on it. The only people who care are marketers, and they can just go fuck themselves.
@techreader: A large part of the point is that most of the early examples don’t make much sense, or work very well. Which is why they are bad database design, and I guarantee you that somewhere, someone has used them. I’ve had to transition data from lots of poorly-designed structures, to better ones.
By showing an evolution from a poorly thought out model to a better thought out model, the author of the article is providing gentle instruction to those that don’t deal with database structures regularly. From the comments attached to the article, it looks like a lot of people learned something, and had to stop and think about they way they do things and think about things like forms, that they rarely did before.
You mention creating a “Families” table, but how would you handle even the traditional mother, father, and two children? Each would have a row in the “Persons” table, but would the children be part of the “Families” table? If they are, then this doesn’t really track marriages, the point of the article, but it does track families, which might be more useful, or not, depending on the context.
I do note in passing that he’s pretty much skipped over the concept of effective dating, which is used to indicate that X was married to Y only from a start date to an end date, then was married to Z from a start date to an end date. This keeps a history record.
Personally, I’m all for abolition of “marriage” at the state and federal level, and substituting legal relationships where necessary. When I visit the hospital, they ask me to list people to contact in the event of my incapacitation, who will be empowered to make decisions for me. Create a database to record those ‘legal relationships’ thus:
Table People
People_Id
First_Name (and do not use length limits)
Middle_Names (ditto)
Last_Name (ditto ditto)
Table Relationship_Types
Relationship_Type_Id
Relationship_Name
Table Relationships
Relationship_Id
Relationship_Person_1
Relationship_Person_2
Relationship_Type_Id
Easy enough, though it doesn’t track precedence or effective dating, either, which would be useful information when a legal relationship is being changed.
@techreader: The Mormons (yes, the Mormons) invented a reasonably ok description format (GEDCOM, see the wikipedia article). If you are serious about modelling a database representation of the real world, you should take a look at GEDCOM and ask yourself: “how much of this can my database handle?”
Of course, as a (good) database engineer you probably also ask: “how much of the real world does my database *need* to handle?”
I figure with the number of hermaphrodites constantly being born out there, if God has refused to assign them a gender, who am I to step in and and assume that responsibility?
Two of my favorite people are refusing to claim a gender:
http://www.advo...wsuit
https://www.google.com/amp/s/www.washingtonpost.com/amphtml/news/morning-mix/wp/2016/07/21/dana-zzyym-doesnt-identify-as-male-or-female-so-they-cant-legally-leave-the-country/
https://ww2.kqed.org/futureofyou/2017/02/15/boy-girl-both-neither-a-new-generation-overthrows-gender/
I suspect this will continue stupidly long as an identifying attribute. Much as “hair color” really doesn’t make any sense (since it’s so easy to change and socially acceptable to do so), but it continues to shamble on as an “identifying” characteristic.