Re: Inserting In a List
On 07.04.2013 20:53, lipska the kat wrote:
I'm probably not the most experienced developer here, 15 years and
counting with Java but I've done everything from Swing based desktop
stuff (yuk) to back end business applications that are presentation
layer agnostic, to state machines that communicate with hardware devices
and apart from one particular instance I can't think of a single time
that I have ever had to use final more than once or twice in a
component. Most components don't use it at all. What are you guys
*doing* that you feel the need to modify all your variables with final
everywhere.
As Arved I think "everywhere" is exaggerated. Some said they do it
habitually because they got used to it and found it useful. That
doesn't necessarily mean that every single item which could be
"finalized" is indeed.
The whole point of a computer is to transform it's input to
some useful output, you store your input, transform it (by updating
variables usually) and emit it in a way that makes sense at that time.
Making those things which are mutable to stand out vs. those which
aren't helps when there are a lot variables around.
One example: I had to modify a 600+ lines method (yeah, ugly). I
started with refactoring because otherwise I would have had zero chance
to fully understand what the code actually did. In the process I
started with moving variable declarations to the most restricted scope
and making things final. That helped my a great deal in understanding
the logic. Then I refactored appropriate parts into separate methods.
This is the kind of experience that led me to find "final" useful.
Kind regards
robert
--
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/