This is a multi-part message in MIME format...
--
To: java400-l@midrange.com
From: jamesl@hb.quik.com
X-Advert: http://emumail.com
Reply-To: jamesl@hb.quik.com
Date: Tue, 09 Apr 2002 18:28:19 EDT
X-Mailer: EMUmail
Subject: Re: Java Style Question
Which is it? I categorically disagree with the notion that performance is a
non-issue; on the matter of setters and getters vs. direct access and
manipulation, I almost never substitute direct manipulation for a setter
method
unless there's simply no way for it to go wrong. On the other hand, if
a value
is not being made available to outside classes, and doesn't require
any sort of
"massage," and there's no other overriding reason to use a
getter, then I see
nothing wrong with direct access.
I also tend to take
steps to avoid defining inner classes for functionality
that could as easily
be implemented in the classes requiring the functionality,
because each
additional class adds to the overhead, and to recognize situations
that
could lead to exceptions, and deal with them before they do so, rather
than
falling back on try/catch to handle things that are already expected. In
one
case, I solved somebody else's problem by doing
so.
--
JHHL