Java For Artists: The Art, Philosophy, And Science Of Object-Oriented Programming

Chapter 22

1. 

What are the three essential purposes of inheritance?

2. 

What is meant by the term engineering trade-off?

3. 

List at least three benefits provided by inheritance.

4. 

What’s the purpose of an interface?

5. 

What’s the difference between an interface and an abstract class?

6. 

Why is compositional design considered to be a force multiplier?

7. 

What is meant by the term polymorphism?

8. 

How much design is good enough?

9. 

What is the fundamental unit of modularity in an object-oriented program?

10. 

What are the five checkpoints of Coad’s Criteria?

Answers

1. 

- as a way to reason about program behavior; as a way to incrementally build program functionality; as a way to gain a measure of reuse within your program

2. 

- Compromise in order to make progress while at the same time taking every practical measure to ensure design goals are achieved

3. 

- as a way to reason about program behavior; as a way to incrementally build program functionality; as a way to gain a measure of reuse within your program

4. 

- An interface specifies type behavior.

5. 

- An abstract class may provide an implementation to one or more of its methods.

6. 

- It combines the power of interfaces, inheritance, and polymorphism

7. 

- To treat different objects in a uniform way

8. 

- The answer to the question of when a design has reached “good enough” is always the same — it depends. It depends on the application’s intended purpose and its associated requirements.

9. 

- the class

10. 

  1. The derived class models an “is a special kind of,” relationship to the base class not an “is a role played by a” relationship. (view)

  2. The derived class never needs to transmute to be an object in some other class. (view)

  3. The derived class extends rather than overrides or nullifies the base class. (functional, uneffecting)

  4. The baseclass is not merely a utility class representing functionality you would simply like to reuse. (constant, machine)

  5. The inheritance hierarchy you are trying to build represents special kinds of roles, transactions, or devices within the application domain.

Категории