Module 2.1: Object Relationships

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/15

encourage image

There's no tags or description

Looks like no tags are added yet.

16 Terms

1
New cards

Object Relationships

Describe how two or more objects are connected or interact with one another in an object-oriented program. They determine how objects use, contain, or inherit characteristics from other objects.

2
New cards

Association

It is known as a "Has-a" relationship because one object has or uses another object. relationship between two objects where one object uses another object, or both objects use each other.

3
New cards

Inheritance

It is known as an "Is-a" relationship because one object belongs to a more general category. A relationship where one class is a more specific version of another class.

4
New cards

Has-a Relationship

Association

5
New cards

Composition

Aggregation

Types of Association.

6
New cards

Composition

A strong ownership relationship where one object depends on the existence of another object. The dependent object is considered part of the owner, and its lifecycle is tied to that owner.

7
New cards

Aggregation

A weak or loose association between two independent objects. Both objects can exist separately, even when their relationship ends.

8
New cards

Object Lifecycle

Refers to the period during which an object exists, from its creation until it is no longer part of the program's object model. It helps determine whether a relationship should be classified as composition or aggregation.

9
New cards

Dependent Object

An object whose existence or usefulness depends on another object in a composition relationship.

10
New cards

Independent Object

An object that can exist and function without depending on another object.

11
New cards

Object Reusability

The ability of an object to be used or referenced in another relationship.

12
New cards

Field Created Inside the Owner's Constructor

A common Java implementation of composition. The owning class creates the dependent object as part of its initialization, suggesting that the owner controls the object's lifecycle.

13
New cards

Field Passed from Outside

A common Java implementation of aggregation. An existing object is passed into another class through a constructor or method, allowing both objects to exist independently.

14
New cards

Object Reference

A way for one object to refer to another object without necessarily owning it. In aggregation, objects are commonly connected through references. Example: A Teacher object can hold references to Student objects.

15
New cards

No

Can the related object still exist independently when the relationship ends in composistion?

16
New cards

Yes

Can the related object still exist independently when the relationship ends in Aggregation?