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

Chapter 10

1. 

What is a dependency relationship between two objects?

2. 

What is an association relationship between two objects?

3. 

What is an aggregation?

4. 

List the two types of aggregation.

5. 

Explain the difference between the two types of aggregation.

6. 

How do you express simple aggregation using a UML class diagram?

7. 

How do you express composite aggregation using a UML class diagram?

8. 

Which type of aggregation denotes a uses or uses a relationship between two objects?

9. 

Which type of aggregation denotes a has or has a relationship between two objects?

10. 

What is the purpose of a UML sequence diagram?

11. 

Explain the utility of the typesafe enumeration pattern.

12. 

A class built from other class types is referred to as a/an ________________________.

13. 

In this type of aggregation part objects belong solely to the whole or containing class. Name the type of aggregation.

14. 

In this type of aggregation part object lifetimes are not controlled by the whole or containing class. Name the type of aggregation.

15. 

In a UML class diagram the aggregation diamond is drawn closest to which class, the whole or the part?

Answers

1. 

- A dependency is a relationship between two classes in which a change made to one class will have an affect on the behavior of the class or classes that depend on it.

2. 

- An association is a relationship between two classes that denotes a connection between those classes. An association implies a peer-to-peer relationship between the classes that participate in the association.

3. 

- An aggregation is an association between two objects that results in a whole/part relationship.

4. 

- simple, composite

5. 

- In a simple aggregation the whole object does not control the lifetime of its part objects. In a composite aggregation, the whole object controls the lifetime of its part objects.

6. 

- By a line connecting the whole class its part class(s). A hollow diamond adorns the line closest to the whole class.

7. 

- By a line connection the whole class to its part class(s). A solid diamond adorns the line closest to the whole class.

8. 

- simple

9. 

- composite

10. 

- The sequence diagram shows message sequencing between application objects.

11. 

- The typesafe enum pattern is used in Java 1.4.2 coding practice in place of enumerated types. (Enumerated types were introduced to the Java language starting with Java 5.)

12. 

- Composite

13. 

- Composite aggregation

14. 

- Simple aggregation

15. 

- the whole class

Категории