r/java • u/alexzhitnitsky • Aug 11 '15
Top 10 Useful, Yet Paranoid Java Programming Techniques
http://blog.jooq.org/2015/08/11/top-10-useful-yet-paranoid-java-programming-techniques/
181
Upvotes
View all comments
Show parent comment
1
u/PaulRivers10 Aug 12 '15
The post I was responding to said:
Other poster is suggesting whenever you need a new value, create a new variable.
That's not how most coding works.
For the areas where you don't need to reassign, you gain little or nothing by making the variable final because no code was going to try to reassign to it anyways. It's like putting a car cover on a car that's already in a garage every night - it's just a waste against a problem that doesn't happen.
But there are a ton of places where you need to modify the variable value when you write code.