NNTP-Posting-Date: Wed, 24 Apr 2013 03:09:09 -0500 Date: Wed, 24 Apr 2013 09:08:19 +0100 From: lipska the kat <"nospam at neversurrender dot co dot uk"> Organization: Trollbusters 3 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130308 Thunderbird/17.0.4 MIME-Version: 1.0 Newsgroups: comp.lang.java.programmer Subject: Re: References: <9h4i4a-kvp.ln1@tempest.fredriksson.dy.fi> <25zdt.2945$N74.2063@newsfe10.iad> <25-dnQ-mLoV6TuvMnZ2dnUVZ7oadnZ2d@bt.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Message-ID: Lines: 56 X-Usenet-Provider: http://www.giganews.com X-AuthenticatedUsername: NoAuthUser X-Trace: sv3-cYLvQPixw/wMMIVFuUyKJ5vO0AOkbh5Mz1Vw/H/jn3ehSrEr3+wcIw/WTUMCDLWbDEGlhp+wpJf5tyj!HJoQr0K04jh58Ulj5V+GF+SfzXlOyLhvMDxzHLz4es/zM3ty9tYpong/Usi1454SlbORs1XWxUI= X-Complaints-To: abuse@btinternet.com X-DMCA-Complaints-To: abuse@btinternet.com X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 4228 Path: csiph.com!usenet.pasdenom.info!news.stben.net!border3.nntp.ams.giganews.com!Xl.tags.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!local2.nntp.ams.giganews.com!nntp.bt.com!news.bt.com.POSTED!not-for-mail Xref: csiph.com comp.lang.java.programmer:23616 On 23/04/13 20:26, Daniel Pitts wrote: > On 4/23/13 11:33 AM, lipska the kat wrote: >> On 23/04/13 17:58, Daniel Pitts wrote: >>> On 4/23/13 9:30 AM, lipska the kat wrote: >>>> On 23/04/13 16:50, Daniel Pitts wrote: >>>>> On 4/23/13 8:37 AM, lipska the kat wrote: >>>>>> On 23/04/13 14:55, Steven Simpson wrote: >>>>>>> On 23/04/13 11:31, Donkey Hottie wrote: >>>>>>>> 23.04.2013 12:48, Steven Simpson kirjoitti: >>>>>>>>> public static String generateWindowsArgument(List>>>>>>>> String> >>>>>>>>> args) { >>>>>>>> java.lang.String is final, so nothing can extend it. >>>>>>>> [snip] >> Actually, in a way, List as a parameter to a method >> might be considered as breaking encapsulation ... you are actually >> exposing part of the internal workings of a component. > > What about the internal workings? That it accepts a List of things it > can treat as Strings. I'm not seeing how that's breaking any encapsulation. No, it is a bit of a leap I agree, allow me to elucidate. Using List> as a parameter exposes the fact that the internal workings do not modify the list ... think about it, what additional information does it convey about the internal workings of the method ... Tenuous maybe but no more tenuous that justifying the use of List by saying that String may be made mutable in future. You know what, this sort of thing makes me really quite angry. Years of looking at other peoples crappy code has left me with a pathological aversion to this type of pointless academic fluff. What is more worrying is that there is a good chance that this sort of nonsense is being propagated down the academic chain to tomorrows graduates. More pointless crappy code to analyze, what fun. > You're actually providing a guarantee that you won't be adding stuff to > this List (since it is a compiler error to do so). Huh ... it is only a compiler error within the scope of the method so that point is irrelevant as far as a client is concerned. If you want to inform clients that the list is not modified do it in the right place, in the documentation, not by some obscure twiddling with the syntax that relies on the user of the method understanding the obscurity. lipska -- Lipska the KatŠ: Troll hunter, sandbox destroyer and farscape dreamer of Aeryn Sun