Hi!
Sorry, can't resist to respond on this, since i'm paranoid at programming ;-)

> Emmanuel Lécharny [mailto:elecha...@gmail.com] wrote
>
> there are a lot of methods which have parameters with a 'final'
> keyword.
> It's most certaibly a IDE configuration, but it's really annoying.

It looks ugly, true. But I have seen so many method like:

myMethod (Param parameter) {
...
parameter = new Param();
...
}

IMHO Oracle should make parameter implicit final!
I don't mark my parameters as final, because it makes the parameter list hard 
to read. But I can understand anyone who does so!

> Can those who have this configuration set in their IDE change it so
> that
> the committed code does not anymore contain the final keyword
> everywhere ?
>
> I personnaly think that the final keyword is useful in two cases :
> - for static fields, like in private statif final int CONSTANT = xxx
> - for variable thet are to be accessed by inner classes

- for (class/object) variables that are not expected to change anymore.

Declaring an AtomicInteger as non-final is a potential threading issue! Anyone 
could replace it with a new object, rendering the synchronisation useless.
The same is true for concurrent collections, locks, monitors, etc. If you don't 
expect (or want) it to change - make it final.
The use of local variables shouldn't be that complex, that they need a final 
statement.

> Side note :
> I know that some may consider that using final for method parameters is
> a way to protect a stupid coder against a modification of a variable.
> Yeah, sure... But we are not stupid coders, are we ?

I'm writing perfect code, but somehow the code changes over time. When I'm 
looking into my code a year later, it looks like a drunken monkey hit on a 
keyboard ;-)

regards

Steve


--------------------------------------------------------------------------
PROEMION GmbH

Steve Ulrich

IT Development (IT/DEV)

Donaustrasse 14
D-36043 Fulda, Germany
Phone +49 (0) 661 9490-601
Fax +49 (0) 661 9490-333

http://www.proemion.com

Geschäftsführer: Dipl. Ing. Robert Michaelides
Amtsgericht-Registergericht-Fulda: 5 HRB 1867
--------------------------------------------------------------------------
E-mail and any attachments may be confidential. If you have received this
E-mail and you are not a named addressee, please inform the sender immediately 
by E-mail and then delete this E-mail from your system. If you are not a named 
addressee, you may not use, disclose, distribute, copy or print this E-mail. 
Addressees should scan this E-mail and any attachments for viruses. No 
representation or warranty is made as to the absence of viruses in this E-mail 
or any of its attachments.

AKTUELLES:
http://www.proemion.de

NEWS:
http://www.proemion.com


Reply via email to