Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail From: Jeff Higgins Newsgroups: comp.lang.java.programmer Subject: Re: Best Way to Pass Info Between Objects? Date: Mon, 09 Jan 2012 14:30:49 -0500 Organization: A noiseless patient Spider Lines: 45 Message-ID: References: <4dWdnRF6pOQcUJTSnZ2dnUVZ_vidnZ2d@earthlink.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Mon, 9 Jan 2012 19:24:06 +0000 (UTC) Injection-Info: mx04.eternal-september.org; posting-host="qwFw1g9RsQ6TkML5yezG9A"; logging-data="11145"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX195B/KrCykWMwfTEKUUdjFMdGBEOrby8Mg=" User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.16) Gecko/20111110 Icedove/3.0.11 In-Reply-To: Cancel-Lock: sha1:rm5dn6BJIIx3qX9O7kNSofnvcsI= Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:11137 On 01/08/2012 01:22 PM, Novice wrote: > Patricia Shanahan wrote in > news:4dWdnRF6pOQcUJTSnZ2dnUVZ_vidnZ2d@earthlink.com: > >> On 1/8/2012 8:41 AM, Novice wrote: >>> Sorry, that's probably not the best of subject lines but I'm having >>> trouble coming up with a concise one.... >>> >>> I'm trying to reason out the best way to pass information from an >>> instantiating class to an instantiated class. So, let's say class Foo >>> invokes class Bar to do something. Bar needs some specific >>> information from Foo to do its job. What is the best way to pass this >>> information from Foo to Bar? >> ... >>> I'm not sure if there is a generally agreed-upon formula here or >>> whether it is more a case of individual style and preference. I'd be >>> very interested in your comments on this subject. Right now, I feel >>> like I'm being pretty inconsistent in my techniques and would like to >>> standardize them along the best possible lines. >>> >> >> Here is one programming process approach that often simplifies these >> questions: Write the Bar unit tests in parallel with designing Bar. >> >> If the Bar design works well for both unit testing and use by a Foo, >> it will probably be a reasonably robust module that does not need to >> be changed too often because of changes to other modules. >> >> Patricia >> > > Thanks everyone for the suggestions. Obviously, I'm going to need to > increase the size of my Java library and allocate some time for reading all > all of these things.... > > But in the meantime, are there any general rules I can use to make these > decisions for code I am developing now? Or do I really need to master > several books first? > Now that you are sufficiently interested in data modelling and software design methodologies: here is a good, fast, cheap jumping in point. It will even do Swing databinding with some extra work (I gather).