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.
Circle
Object?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 going to be?
If the applet has 100 circles drawn in it,
is each one an object?
Or is there going to be just one Circle
object
that can be regarded as a "drawing tool"
that is moved throught the drawing area as the many circles are
drawn?
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.