We've expanded our news coverage and improved our search! Visit
oreilly.com for the latest or search for all things across O'Reilly!
Article:
 |
|
Seven Low-Cost Ways to Improve Legacy Code
|
Subject: |
|
Heuristics vs Rules |
Date: |
|
2004-10-28 08:37:52 |
From: |
|
dubwai
|
Response to: Heuristics vs Rules
|
No you don't lose anything by doing it and in fact I've decided that if we could go back an design Java from the ground up, all parameters should be implicitly final. The only advantage that non-final parameters give is that you can reuse them as locla variables. That is, there's really no meaningful advantage at all.
Marking the parameter final is a useful technique. It's the only way to compile check that you are not making the "setting the parameter instead of the member" mistake that 'every' developer has made. But I've never had it help me when the method is not setting a member of the class or instance. I'm not really sure how it would.
|