Comment

Comment by WHoWHo

From my experience in 20 years of Java, it prevents the reusage of local vars, which mostly is wrong.

   Person p = ....
   p = doSomething(p)
   ...
   p = doSomethingElse(p)
is hard to reason about when it should be

   Person p = ....
   ... lots of code
   Person updated = doSomething(p) 
   ... lots of code
   doSomethingElse(updated)
Which is easier to read and understand. So you might have had bugs that would have been prevented with final, but you didn't attribute to final.
parent WHoWHo 8 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton