go to previous page   go to home page   go to next page

Answer:

In general, a Circle object's data should say where it is, and it should have methods that draw it. It should also have one (or more) constructors.


What is a Circle Object?

circle template

Let us be more specific about our goal:

Design a class for drawing circles in an applet. We want several convenient ways to say were the circles are located.

We have an important design decision: What exactly is a Circle object? If the applet has 100 circles, is each one an object? Or is there just one Circle object that works as a "drawing tool" that is used to draw each circle?

The answer to this question depends on our goal. As stated, the goal is to make it convenient to draw many circles. The drawing will be a static work of "art" that is not used interactively. Probably the "drawing tool" object is most approriate. Our Circle object will be like a plastic template with circles of various sizes used with pencil and paper to draw circles.


QUESTION 2:

(Design Question: ) When would it be more useful to regard each circle as an individual object?