Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!news.glorb.com!npeer03.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!spln!extra.newsguy.com!newsp.newsguy.com!news2 From: Wojtek Newsgroups: comp.lang.java.programmer Subject: Re: Call by Result Date: Sat, 11 Jun 2011 16:24:39 -0700 Organization: NewsGuy - Unlimited Usenet $19.95 Lines: 26 Message-ID: References: <4df23fe3$0$12157$fa0fcedb@news.zen.co.uk> NNTP-Posting-Host: p0ab3e8f4b45330f8307d38e942910cd663724f4313787584.newsdawg.com Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-15"; format=flowed Content-Transfer-Encoding: 8bit X-Newsreader: MesNews/1.08.03.00-gb Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:5227 Gene Wirchenko wrote : >> I think Stephan Ram's answer is roughly what I would do. >> >> String returnString; >> Thagomizor thangomizor = new Thagomizor(); >> thangomizor.thangomize(); >> if (!thangomizor.didItWork()) { >> throw new TooBadException(); >> } else { >> returnString = thangomizor.getString(); >> } > > Lengthy code (compared with what it could be) to no additional > benefit. The benefit is that it is instantly recognizable by any competent Java programmer as to what it does and how any problem is handled. If you want minimal source code size, then Java is not for you. -- Wojtek :-)