Chapter 11: Object-Oriented Design

11.1 Introduction

The first nine chapters of the book discussed how to structure the objects in a problem, and Chapter 10 addressed how to organize the relationships between objects for utility objects. The discussion in Chapter 10 suggested that composition should always be preferred over classification when designing and constructing utility objects; however, most objects used in a program are not utility objects but represent parts of the problem definition. When the objects are part of the problem definition, should composition or classification be used when constructing an object?

The choice of composition or classification can normally be determined by answering the question, “Is the relationship between ...

Get Creating Components now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.