Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail From: markspace <-@.> Newsgroups: comp.lang.java.programmer Subject: Re: Wormholes Date: Mon, 03 Sep 2012 21:00:39 -0700 Organization: A noiseless patient Spider Lines: 28 Message-ID: References: <0ska4895k2mp2j5fb5p4qnue7lsbdpoeoo@4ax.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Tue, 4 Sep 2012 04:00:40 +0000 (UTC) Injection-Info: mx04.eternal-september.org; posting-host="61282af8d6595e8d991edb5ac03d6e00"; logging-data="30565"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19CXyvs5kJ4ZBFmS997NpyQwp/29aQ2jiM=" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:15.0) Gecko/20120824 Thunderbird/15.0 In-Reply-To: <0ska4895k2mp2j5fb5p4qnue7lsbdpoeoo@4ax.com> Cancel-Lock: sha1:b4Rpiw8bKvm4OnNPkuhGwo4RG44= Xref: csiph.com comp.lang.java.programmer:18526 On 9/3/2012 6:12 PM, Roedy Green wrote: > I run into this sort of problem fairly often. > > I have a method x that calls method y through a long chain of > intermediate calls. I think I'm with Eric F. on this. Given some long chain of calls: X, A, B, C D, ... Y, can that be refactored so that X calls Y directly? void methodX() { A(); } to void methodX() { AResult result = A(); X( result, otherData ); } I'm thinking that if your methods have to pass data through a long chain of calls, then the code is badly structured period. You might as well use the opportunity to refactor rather than trying to invent a "wormhole." I can think of at least one way to implement a wormhole. I'm just not going to go there because it's a terrible idea.