On 2010-06-16 12:23:40 -0700, Josh Cheek said:

> [Note:  parts of this message were removed to make it a legal post.]
> 
> On Wed, Jun 16, 2010 at 1:45 PM, Rein Henrichs <reinh / reinh.com> wrote:
> 
>> Just set the instance variables yourself. Stop replacing clear, explicit
>> code with metaprogramming magic that you can't understand the day after you
>> write it.
>> 
> 
> The original post did not use instance variables, so there is no way to know
> that the "self.step = 0" is the same as "@step = 0". Hence my explicit
> decision to make sum_of_income a method which must perform calculations, and
> accesses an ivar that is not named after the method.

Good point.

> 
> Besides I think that is not something you should do, because it means you
> are accessing ivars all over the place, which couples implementation. If you
> always use the setter, then you have a gate keeper to that var, and can
> easily change implementation later, without having to go hunt down all the
> places you used the ivars.

Use of direct/indirect variable access is an important thing to think 
critically about. I think that settings ivars in initialize methods is 
perfectly acceptable. I share your concern with inconsistent use of 
getters / variables throughout the code.

-- 
Rein Henrichs
http://puppetlabs.com
http://reinh.com