« LaLa: File-Sharing in the Real World | Main | Climate Change Becoming a Real Concern »

Keyword 'final' in Java

I've been a strong advocate of the 'final' keyword in the Java language. It's an effective way of communicating to both humans and machines (the compiler & JVM) that a class/method/field/variable cannot be modified or extended. A while ago, I had a heated discussion with a former co-worker regarding the necessity of the 'final' keyword in variable declarations because he felt they were unnecessary and cluttered up the code. My opinion on the issue is that the readability of code can be addressed easily by choosing a coding-style that suits your tastes, and that producing code with ambiguous behavior can be extremely difficult to correct and is very error-prone. I recently found a great web page that explains why the 'final' keyword is so valuable. It's a worthwhile read, if that's your thing.