• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Objects and Behaviors

 
Momen Travolta
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A circle object, for example, has a data field, radius, which is the property that characterizes a circle. One behavior of a circle is that its area can be computed using the method getArea().

1)To me, area is a property/characteristic, not a behavior
2)getting the area is a behavior, but it`s not a behavior of the circle.

So, why is the getArea() method, considered a behavior of the object "circle"?
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What would you consider it a behavior of? A 2d shape, of which circle is one. *Calculating* area is a behavior.

You're over-thinking this--I'd encourage you not to get hung up on semantics whenever possible. And it's almost always possible.
 
Campbell Ritchie
Sheriff
Pie
Posts: 50277
80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

Circles are easy to work out the fields of; in 2-D they can never have more than 3 fields. Radius, x-position and y-position (of the centre). The area is derivative of the radius and is therefore calculated from it.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic