Chapter 9_Code Reuse, Making Changes in Class Hierarchy

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/26

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

27 Terms

1
New cards

Code reuse

______________ is the practice of using existing code to develop new applications.

2
New cards

Code reuse

It is a fundamental principle of software engineering that allows developers to save time and effort by leveraging existing code libraries, frameworks, and modules.

3
New cards

Inheritance

Composition

Delegation.

There are several ways to achieve code reuse including (3)

4
New cards

Inheritance

__________ is a mechanism that allows a class to inherit properties and methods from another class. In this approach, a subclass (or derived class) is created by inheriting properties and methods from a superclass (or base class).

5
New cards

Inheritance

__________ is useful when creating a family of related classes that share common functionality.

6
New cards

Composition

_____________ is a mechanism that allows a class to contain instances of other classes as members. In this approach, a class is composed of one or more objects of other classes. This enables the class to reuse the functionality of the contained objects without inheriting from them.

7
New cards

Composition

____________ is useful when creating complex classes that have a set of common behaviors, but the relationships between the behaviors are not well-defined.

8
New cards

Delegation

____________ is a mechanism that allows a class to delegate responsibility for a task to another class. In this approach, a class delegates the implementation of a method to another object that is responsible for providing the implementation.

9
New cards

Delegation

___________ is useful when creating classes that have a single responsibility and collaborate with other classes to achieve that responsibility.

10
New cards

"is-a" relationship

In Java, an _________________ is a term used to describe the relationship between two classes, where one class is a specialized version of the other.

11
New cards

"is-a" relationship

Used in inheritance:

The _________________ is important in Java because it allows developers to reuse code and create more efficient and flexible programs

12
New cards

Inheritance or Subclassing

The “is-a” relationship is also known as?

13
New cards

Inheritance or Subclassing

____________ or ____________ - In this relationship, the subclass (or derived class) inherits properties and behaviors from its superclass (or base class).

14
New cards

hierarchy

By using inheritance, developers can create a __________ of classes that share common properties and behaviors, while also allowing for specialization and customization in subclasses.

15
New cards

Inheritance

The diagram shows code reusablity by using?

<p>The diagram shows code reusablity by using?</p>
16
New cards

Has-A-Relation

In Java, _______________ is a type of relationship between classes, which is used to define the ownership of one object by another object.

17
New cards

composition, aggregation

The Has-A-Relation relationship is also known as ____________ or ____________.

18
New cards

Composition

______________ is a strong form of the Has-A-Relation, where one class owns the other class and is responsible for its lifetime. If the owner class is destroyed, then the owned class is also destroyed.

19
New cards

"whole-part", "containment"

Composition represents a _________ or __________relationship between two classes, where one class is composed of one or more objects of another class.

20
New cards

Composition

The diagram shows a _____________ relationship.

<p>The diagram shows a _____________ relationship.</p>
21
New cards

Aggregation, part class

____________ in Java is a type of relationship between two classes where one class, the aggregate class, has a reference to the other class, the ___________.

22
New cards

part class

The aggregate class is considered to own the _____________

23
New cards

Aggregation

The diagram shows a ____________ relationship.

<p>The diagram shows a ____________ relationship.</p>
24
New cards

Delegation

____________ is a mechanism that allows a class to delegate responsibility for a task to another class. In this approach, a class delegates the implementation of a method to another object that is responsible for providing the implementation

25
New cards

Delegation

This enables the class to reuse the functionality of the delegate object without having to implement it itself

26
New cards

Delegation

is useful when creating classes that have a single responsibility and collaborate with other classes to achieve that responsibility.

27
New cards

Delegation

This shows a ____________ relationship.

<p>This shows a ____________ relationship.</p>