This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Objects and Behaviors Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Objects and Behaviors" Watch "Objects and Behaviors" New topic
Author

Objects and Behaviors

Momen Travolta
Greenhorn

Joined: Mar 19, 2010
Posts: 8
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

Joined: Sep 29, 2008
Posts: 12617

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

Joined: Oct 13, 2005
Posts: 43905
    
  33
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.
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: Objects and Behaviors
 
jQuery in Action, 3rd edition