Upload
emmeline-bailey
View
221
Download
3
Tags:
Embed Size (px)
Citation preview
RelationshipsCopyright © 1999 Patrick McDermott
UC BerkeleyExtension
Mary Cassatt (1844–1926)Mother and Child against a Green Background
1887
ConnectionsCRC Cards: CollaborationERD: Relationship Relational: Foreign KeyDatabase: Database Key Programmer: Pointer, Array, ContainmentUML: AssociationEtc., etc., etc.…: Set, Pairing,
Parent/Child, Owner/MembersSome track: Aggregation, Composition
Types
1. Existence ∃– Employee has Dependent Children– Auto has AirConditioner
2. Functional– Professor teaches Class– Customer Registers
3. Event– Customer places Order– Auto Accident Happens
STUDENT
NameAddressTelephoneEnroll()Party()Flunk()DropOut()
TEACHER
NameAddressTelephoneGetHired() GetPaid()Grade()
UML Simple RELATIONSHIPS
Cardinality
1 to 1
1 to Many
Many to Many
Use Connector (Not Line)
*
**
1 1
1
Of Hottentots, Russians & Systems Analysts
Many:
∞*MN
Association & Relationship
ASSOCIATION: The semantic relationship among two or more classifiers that involves connections among their instances.—Rumbaugh, Reference, p. 152
RELATIONSHIP: A reified semantic connection among model elements. Kinds of relationships include association, generalization, flow, and several kinds of dependency.—Rumbaugh, Reference, p. 411
SO: An association is a kind of relationship, one that isn’t any other kind… —Patrick
1-to-Many• The One side is called
1. “Parent”
2. The Set Owner
3. Root
• The Many side is called1. “Child”
2. A “Member”
3. Branch/Leaf
ShunchōAutumn Excursion during an Abundant Harvest
1770-90
Relationship an Entity?• Relationships have no Attributes• If you need attributes, it’s an Entity• Sometimes called “Junction Class/Record”• Sometimes called “Associative Entity”• ALL entities with 2 owners are associative
– Whether planned or not
Kinds of Relationships
Object Relativity1. Generalization/Specialization
– IS-A2. Aggregation
– IS-PART-OF3. Composition
– IS-MADE-WITH, IS-MADE-FROM
4. Categories– TYPE, KIND-OF, STATUS
5. Sets– IS-COLLECTION-OF, GROUP-OF
Object Examples1. Generalization/Specialization
– A GraduateStudent is a Student
2. Aggregation– A Student is part of a ClassRoster
3. Composition– An Car is made with an Engine
4. Categories– A Sophomore is a type of Student
5. Sets– A Hearing is a collection of Party, Lawyer,
Judge, CourtReporter, CourtRoom
Types of Relationship• IS-A: Generalization, “Inheritance”
• HAS-A: Aggregation• IS-Made-From: Composition
– “A form of aggregation with strong ownership and coincident lifetime of parts by the whole.”– Rumbaugh, Reference, p. 226
– I don’t bother distinguishing from Aggregation
• USES: Association– Default; those that aren’t one of the others
Patrick’s RuleA Relationship is a connection of some
kind between two objects that is significant to the business or system.
Generalizations and aggregations willusually be identified as such, so the genericrelationship is usually not believed to be oneof those. So we will assume an Association until shown otherwise.
The relational model only recognizes Associations, so you won’t be too far off if that’s all you use.
K.I.S.S.
Keep it Simple,Stupid