----- Original Message -----
From: "Chris McCabe" <[EMAIL PROTECTED]>


>
> The purpose of the final keyword is not for performance reasons, and
> using it as such makes for a bad design.  Sometimes we can live with a
> little bad design if it makes a big difference in performance, but I
> don't think this is the case anymore, and the final keyword should be
> used appropriately.  There are some good valid reasons to use final,
> such as:
>

 Chris, I think all your points are valid from a software engineering
standpoint. I also agree that the use of final does not buy much in terms of
performance, but sometimes a minor improvement is welcome too (akin to not
adding "virtual" if not needed in C++). Besides, I don't think it is hard to
"definalize" things.

> This is why String and the primitive objects
> such as Integer and Double are declared final.  Otherwise you could
> simply subclass the object and do what you want, which would mean that
> you would have to make a copy of every String that you wanted to hold on
to.

 I agree with your comments, except for the one above. What do you mean "do
what you want"? Instance variables in those classes are private.

-- Santiago


Reply via email to