Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Robert Klemme Newsgroups: comp.lang.java.programmer Subject: Re: Inserting In a List Date: Mon, 08 Apr 2013 08:28:44 +0200 Lines: 40 Message-ID: References: <19un43xj77bua.vw45l4e2wshi.dlg@40tude.net> <8MWdnbEIVKIMXfzMnZ2dnUVZ8tednZ2d@bt.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net ZD6kpbBrR+YqYMFt2oE6Wgb9f+ZhzIoQWpOvh56uGtTftS+OQ= Cancel-Lock: sha1:+BHIv5NXwi5I1K1Sip5caTGubRo= User-Agent: Mozilla/5.0 (Windows NT 6.0; WOW64; rv:17.0) Gecko/20130328 Thunderbird/17.0.5 In-Reply-To: <8MWdnbEIVKIMXfzMnZ2dnUVZ8tednZ2d@bt.com> X-Antivirus: avast! (VPS 130407-1, 07.04.2013), Outbound message X-Antivirus-Status: Clean Xref: csiph.com comp.lang.java.programmer:23375 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/