1/26
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
Code reuse
______________ is the practice of using existing code to develop new applications.
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.
Inheritance
Composition
Delegation.
There are several ways to achieve code reuse including (3)
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).
Inheritance
__________ is useful when creating a family of related classes that share common functionality.
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.
Composition
____________ is useful when creating complex classes that have a set of common behaviors, but the relationships between the behaviors are not well-defined.
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.
Delegation
___________ is useful when creating classes that have a single responsibility and collaborate with other classes to achieve that responsibility.
"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.
"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
Inheritance or Subclassing
The “is-a” relationship is also known as?
Inheritance or Subclassing
____________ or ____________ - In this relationship, the subclass (or derived class) inherits properties and behaviors from its superclass (or base class).
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.
Inheritance
The diagram shows code reusablity by using?
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.
composition, aggregation
The Has-A-Relation relationship is also known as ____________ or ____________.
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.
"whole-part", "containment"
Composition represents a _________ or __________relationship between two classes, where one class is composed of one or more objects of another class.
Composition
The diagram shows a _____________ relationship.
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 ___________.
part class
The aggregate class is considered to own the _____________
Aggregation
The diagram shows a ____________ relationship.
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
Delegation
This enables the class to reuse the functionality of the delegate object without having to implement it itself
Delegation
is useful when creating classes that have a single responsibility and collaborate with other classes to achieve that responsibility.
Delegation
This shows a ____________ relationship.