1/12
These flashcards cover key vocabulary and concepts regarding class relationships, associations, and dependencies in object-oriented programming.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
Class Relationships
Interactions between classes in object-oriented programming that define how objects communicate or depend on each other.
Inheritance
A relationship where one class (child/subclass) inherits properties and behaviors from another (parent/superclass).
Association
A relationship between two classes where one class uses the functionality or data of another, defined as a 'has-a' relationship.
Navigability
The ability of one class to 'see' or access another class in an association.
Multiplicity
Specifies how many objects of one class can be associated with another in a relationship.
Unidirectional Association
A relationship where one class is aware of and interacts with another, but the reverse is not true.
Bidirectional Association
A relationship where both classes can access each other.
Aggregation
A special form of association representing a 'whole-part' relationship where one class owns another but both can exist independently.
Composition
A stronger form of aggregation where if the whole is destroyed, the parts also cease to exist.
Dependency
A temporary interaction where one class relies on another class briefly, typically within a method.
Circular Dependency
Occurs when two or more classes depend on each other, making the code harder to understand and maintain.
Best Practices for Dependencies
Include using dependency injection, minimizing dependencies, and avoiding retaining unnecessary references.
Overuse of Bidirectional Associations
Can lead to a high degree of coupling between classes, making the system harder to maintain.