Exactly my thoughts... What I was thinking is that if I accessed the instance
variables directly, when I needed to add
some validation (or some other code), I'd have to retrofit those accesses to
use the getter/setter methods...
How much overhead does using getter/setter methods (for that matter, any
classes) incur? Not sure how much work the JVM
has to do to get to the code, especially if the class has already been
instantiated. I assume the JVM has to work
harder (I/O, linkage issues) if the class is located somewhere else (different
package, for example).
Anyone have some field experience here???
thanks
dan
-----Original Message-----
From: Jim Langston [mailto:jlangston@celsinc.com]
Sent: Monday, April 08, 2002 2:01 PM
To: 'java400-l@midrange.com'
Subject: RE: Java Style Question
<snip>
If, on the other hand, there was validity checking in the Set method then I
would use the Set method instead if I wanted that validity checking in the
method I was coding.
<snip>