All valid points. I'm sold. I'll start using setters/getters internal to
my class also now.
Thanks,
Jim Langston
-----Original Message-----
From: Larry Loen [mailto:lwloen@us.ibm.com]
The question is a practical one -- are you likely to have MyVar be the
subject of some form of inheritance? Will the apparent simple assignment
becomes something else in the child? In that case, getters and setters are
mandetory.
-----Original Message-----
From: Joe Pluta [mailto:joepluta@PlutaBrothers.com]
This is a crucial observation, and one that is not easy to fully grasp. The
idea is simple: will you at some point need to override how this field is
accessed? It is not always immediately obvious whether this will be the
case.
-----Original Message-----
From: Richard Dettinger [mailto:cujo@us.ibm.com]
As another seasoned Java programmer that has been through some ugly issues
in my day, I second the vote for using getter/setter methods. What seems
(and is) innocent access to variables at the time can cause terrible
headaches for you later. Two examples I've found:
-----Original Message-----
From: Ducret, Gilles (CH) [mailto:Gilles.DUCRET@lloydsbank.ch]
I do prefer use getter and setter inside the class too. I can then ensure
validity checking.