Landon,

If the method is only to be used by that class then make it a private
method on the class.

If the method requires the class and is something related to operating
on that class make it a public method on the class.

If the method is something that could be used by many classes and is not
really related to a specific class make it a static method on a utility
class. Another case for this is if operate on objects from a 3rd party
library and creating a subclass wouldn't make sense.

Paul

Sunburned Surveyor wrote:
> I've got a general question about Object-Oriented Programming that I
> run into sometimes, and I thought some of the programmers on this list
> would have some insightful comments.
>
> When you are designing a class, how do you decide when a method
> belongs to the object under design, or when it belongs in another
> class?
>
> For example, I usually place methods that modify an object, but that
> do not require "internal state" for their own behavior in a utility
> class. (This class usually contains only static methods.) I put all
> other methods in the class under design.
>
> What other reasons might there be to move a method from the class
> under design to another class? Are there some design principles that I
> can follow?
>
> Thanks,
>
> The Sunburned Surveyor
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems?  Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >> http://get.splunk.com/
> _______________________________________________
> Jump-pilot-devel mailing list
> Jump-pilot-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
>   


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel

Reply via email to