I was having a discussion with someone the other day, and was having a hard time thinking of the practical benefits of one database design over another. I was advocating the more normalized version, whereas the other party was advocating the non-normalized one.
Consider these two designs:
Facts | |||
|---|---|---|---|
| fact_id | type | name | data |
| 1 | 1 | foo | foo is a fooity foo |
| 2 | 1 | bar | bar is a barrish baaar |
| 3 | 2 | foog | 1 |
Facts | ||
|---|---|---|
| fact_id | name | fact |
| 1 | foo | foo is a fooity foo |
| 2 | bar | bar is a barrish baaar |
Aliases | ||
|---|---|---|
| alias_id | fact_id | name |
| 1 | 1 | foog |
Update: these designs attempt to store a list of facts (think of dictionary definitions), and aliases. A fact is comprised of a word (what I called name), and a definition (what I called fact). There are also aliases, which have a word (again, name), but no definition. They point to another fact for the definition. This way, when the original fact is changed, the aliased one appears to be changed too.
To my eyes, Design 1 is not normalized to a satisfactory extent (i.e. none at all). The data column's meaning changes depending on the value of the type column. Even though I am not well-versed enough to cite what principle of normalization this violates, it feels wrong to me.
Despite this intuitive feeling that it's "just wrong," I had a hard time articulating what about it is wrong. I could not think of any practical reasons to use Design 2. I cited what I consider a powerful abstract reason, separation of cocerns. To me, Facts and Aliases are different types of values, and should not be shoehorned into the same table. The other party did not agree with this assessment, and continued to demand practical reasons.
So I come to you, my fellow Monks, in search of answers. Perhaps I am dead wrong, and the original design is perfectly acceptible? Maybe there is a more powerful abstract reason I can not think of? Or perhaps there are even some good practical reasons? Any responses will be greatly appreciated.
In reply to OT: benefits of database normalization by revdiablo
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |