Association Relationships Flashcards

(11 cards)

1
Q

What is an association?

A

The relationship between two objects

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Composition

A

A type of association represented by a filled diamond in which a whole relationship occurs. Eg An engine is a part of a car

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Aggregation

A

A type of association represented by a non filled diamond. This is a relationship in which another class holds a collection of instances of another class. Eg a buyer may have a cart which is a collection of products (Buyer has products)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Benefits of associations

A

Control visibility of other object to client classes and reuse what we need

Client object can communicate with engine but not a piston

If we need to change anything in the piston class, the car class may need to change but not the client class.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Inheritance vs Composition

A

Composition is done at runtime with dynamic binding ie type of object not determined until runtime
Whereas inheritance is done at compile time through static binding. (type of object is fixed at compile time)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What are Association classes?

A

Allow you to add attributes operations and state to associations

Person -> Employed by -> Company

Instead of storing their employee data in the person class, it can be stored in an employee class

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Benefit of Association classes

A

There can only be one instance of the association class between two participating objects

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is a self association/reflexive association?

A

if the same class appears twice in an association, the two instances do not have to be the same object. Eg someone may have a friend association with another person

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What does a Qualifier do?

A

Distinguishes the set of objects at the far end of the association based on the qualifier value.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Qualified association

A

An association with a qualifier is a qualified association. The uml equivalent of dictionaries

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Example of qualified association

A

Publisher(Genre) -> Book

How well did you know this?
1
Not at all
2
3
4
5
Perfectly