Relationships

370 views
346 views

Published on

Makes the case for focusing on relationships during data modeling to get improved fidelity, better user interfaces and greater longevity from your database.

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
370
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
16
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Relationships

  1. 1. Relationships The [Missing] Link Michael P. Meier WhiteLake Data Management
  2. 2. What I’m Going to Tell You <ul><li>Data Architects ignore relationships </li></ul><ul><li>This includes all types </li></ul><ul><ul><li>Inter-personal </li></ul></ul><ul><ul><li>Logical </li></ul></ul><ul><ul><li>Physical (data) </li></ul></ul><ul><li>We’re suffering without relationship </li></ul><ul><li>Here’s what we need to do. </li></ul>
  3. 3. Modeling Formalisms <ul><li>ERA (entity-relationship-attribute and variants) </li></ul><ul><li>UML (unified modeling language) </li></ul><ul><li>ORM (object-role model) </li></ul><ul><li>None today give more than lip service </li></ul>
  4. 4. It wasn’t always so <ul><li>Peter Chen (1976)* represented relationships as diamond-shaped </li></ul><ul><li>Two-dimensional symbols gave relationships equal weight with entities </li></ul><ul><li>3NF relational schemas were the goal </li></ul>*1976 article published in ACM’s Transactions on Database Systems
  5. 5. Chen Diagram doctor doctor consultation Dr-pt residency
  6. 6. Chen Diagram Suggests <ul><li>Three different relationships exist between two doctors </li></ul><ul><li>An implementation consisting of three tables to represent the relationships </li></ul><ul><li>The relationships may have additional properties that are different </li></ul><ul><ul><li>Dates (start, end) </li></ul></ul><ul><ul><li>Relationships to other entities </li></ul></ul><ul><ul><li>Rotation, Diagnosis, Recommendation,… </li></ul></ul>
  7. 7. “Modern” Interpretation Doctor Doctor or Doctor We usually don’t even get names on the “relationships.”
  8. 8. Which Suggests <ul><li>Three foreign key references to Doctor within the Doctor table </li></ul><ul><li>Meaning that </li></ul><ul><ul><li>Additional relationships and attributes are lost. </li></ul></ul><ul><ul><li>Or, 3NF is lost (by including information about the relationship in the Doctor entity) </li></ul></ul>
  9. 9. More Importantly <ul><li>The relationship is a detail </li></ul><ul><ul><li>A connector on a diagram </li></ul></ul><ul><li>When it should be a core piece of intelligence about the business </li></ul><ul><li>The majority of business rules are about relationships. </li></ul><ul><li>Models and applications suffer from trivializing relationships </li></ul>
  10. 10. Even Worse Doctor This is what we usually see. This is the barest hint about the possible existence of relationships
  11. 11. Effect on Data Quality <ul><li>Inattention to relationships leads to the worst sort of data quality problem. </li></ul><ul><li>The “I meant” problem </li></ul><ul><ul><li>A foreign key column in a table contains values that share </li></ul></ul><ul><ul><ul><li>Data type </li></ul></ul></ul><ul><ul><ul><li>Domain </li></ul></ul></ul><ul><ul><ul><li>Range </li></ul></ul></ul><ul><ul><li>But were placed there for different reasons </li></ul></ul><ul><ul><ul><li>Therefore have different semantic values </li></ul></ul></ul>
  12. 12. Undefined Relationships <ul><li>Result in poorly designed user interfaces </li></ul><ul><li>Undocumented rules </li></ul><ul><li>Reporting nightmares </li></ul><ul><li>Data degradation </li></ul><ul><li>Unattributed or improperly attributed costs to the business </li></ul>
  13. 13. Suggestions <ul><li>Always name relationships—including role names. </li></ul><ul><li>Supply a description for the relationship </li></ul><ul><li>Always model relationships as entities. </li></ul><ul><li>Investigate them. They probably have attributes and possibly relationships. </li></ul><ul><ul><li>Events are really relationships </li></ul></ul><ul><ul><li>Often n-ary relationships (more than two participants) </li></ul></ul><ul><li>Think, really think, before you “denormalize” your physical model </li></ul><ul><ul><li>At least start with a normalized model </li></ul></ul><ul><ul><li>Many use “denormalize” as an excuse not to do the work. </li></ul></ul>
  14. 14. There is nothing simple about a relationship. <ul><li>Ask your spouse, significant other, friends, neighbors… </li></ul><ul><li>Relationships are continuously being renegotiated (changing). </li></ul><ul><li>Give them attention up front or pay dearly later. </li></ul>

×