Hello,
Sun and other sources state that constants should be named in
ALL_UPPER_CASE. This is ok, but what the hell is a constant?
Someone stated some time ago constants only apply to 'static final
fields' being simple types like int, String, Color etc.
What if I have a
protected static final Properties ... = new Properties()?
Write the field in ALL_UPPER_CASE like PRP or PROPS? It it just me or
do I get eye cancer here?
Aren't constants declarations which involve mostly immutable cl*****/
objects? The int in itself can't be changed once declared final, final
instances of some class are basically mutable given certain access
methods, so String's, awt.Color's should *not* be called constants
strictly, but can be considered immutable. Other cl***** used like
collections, Properties and custom cl***** are definitely inherently
mutable and (to answer the above question myself) should not be
declared in UPPER_CASE.
I'm unsure for which declarations this convention is meant for...
What about final parameters? What about final local variables?
Remember these cannot be declared as static, so logically 'constants',
if said to be static only, never apply to parameters and local
variables...
Can anyone confirm that please? Discussions welcome.
Karsten


|