r/java • • Mar 05 '18

Top 10 Useful, Yet Paranoid Java Programming Techniques

http://blog.jooq.org/2015/08/11/top-10-useful-yet-paranoid-java-programming-techniques/
223 Upvotes

105 comments sorted by

View all comments

52

u/AlainBienvenue Mar 05 '18

Like the author, as someone who has been coding in Java since 1999, I do not see anything wrong or even paranoid with any of these. Just good practices.

12

u/random314 Mar 05 '18

I don't enforce the always final rule, I've seen it done before but never really myself. Is it considered a very good practice? If so I might propose it to my team (we have a "good practice" checklist) in our next retro.

0

u/[deleted] Mar 06 '18

[deleted]

3

u/random314 Mar 06 '18

I think the idea is that variables should only be mutable because the algorithm requires it so. Your logic requires a mutable variable so you would manually define that as mutable while leaving everything else immutable (until you need it otherwise of course).