Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!.POSTED!not-for-mail From: Steven Simpson Newsgroups: comp.lang.java.programmer Subject: Re: generics puzzle Date: Tue, 18 Oct 2011 10:45:07 +0100 Organization: Aioe.org NNTP Server Lines: 32 Message-ID: <3euvm8-ee2.ln1@news.simpsonst.f2s.com> References: <9g2f24Fi0vU1@mid.individual.net> NNTP-Posting-Host: +OtMWoPgdjzBynE4wG2yIw.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.23) Gecko/20110922 Lightning/1.0b2 Thunderbird/3.1.15 X-Notice: Filtered by postfilter v. 0.8.2 Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:8944 On 17/10/11 16:58, Daniel Pitts wrote: > On 10/17/11 5:14 AM, Steven Simpson wrote: >> On 17/10/11 11:41, blmblm@myrealbox.com wrote: >>> One fix is to just introduce a method setFromModified() in GThing, >>> but that doesn't appeal to me. >> >> Instead of adding it to GThing, create a static method: >> >> private static void setModified(GThing t) { >> t.set(t.modified()); >> } > > > What about the simpler solution: > > in the GThing class: > > public void setModified() { > set(modified()); > } It "doesn't appeal" to the OP? Nor to me. Not sure I can put my finger on it, but if I were the maintainer of GThing, I'd consider its specification to be complete without this method. It doesn't increase the value of the class as an abstraction. Adding it would certainly just be a convenience for the caller. It solves a problem generated by the design of the call site, not the design of the class's contract. The caller can write his own routine as necessary. -- ss at comp dot lancs dot ac dot uk