On 31.08.2007 03:54, Michael T. Richter wrote:
> On Fri, 2007-31-08 at 10:35 +0900, Kenneth McDonald wrote:
>> To a newcomer, it's sorta nonobvious, however--it turned out the problem 
>> was that I'd made a circular reference to 'values' instead of '@values', 
>> and the fact that the stack was full of 'values' frames is certainly not 
>> obvious from the above.
> 
> A good rule of thumb for avoiding this problem is to name your classes 
> and your variables after nouns and your methods after verbs.
> 
> So instead of having a method "values" that uses the member "@values" -- 
> something pretty much guaranteed to lead to trauma at some point down 
> the road -- make a method "get_values" or "set_values" or 
> "initialize_values" or whatever that uses a member called @values.

Although I agree in general (i.e. using verbs for method names) I 
heavily disagree with your last advice: according to Ruby's convention a 
getter is named "foo" and a setter "foo=".  This is implemented in attr* 
methods and IMHO it is not advisable to leave this convention.

Also, there are good reasons to use getters instead of instance 
variables, namely that you get more abstraction (there doesn't 
necessarily have to be a member variable of that name).

Kind regards

	robert