From: Matthew, Graeme [mailto:Graeme.Matthew@mercer.com]
If I create reader and writer attributes
attr_reader :code, :name, :telephone
attr_writer :name, :telephone
if you define, for example,
and the object client use obj.foo and obj.foo= extensively, and you later
want to add side effects to changing/looking at @foo, you can just get rid
of the accessor and go for functions:
#attr_accessor :foo (not needed anymore)
@foo = newFoo
Happily, no client code needs to change. You’ve transparently changed
behaviour, preserving contracts. You are a happy little vegemite.
Similarly, for private, just throw private in above the two functions in the
last example. You break the client code, but thats the nature of privacy.
David, the Other.