From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,56dbd715fa74735a X-Google-Attributes: gid103376,public From: John Volan Subject: Re: Mutually dependent private types Date: 1998/05/29 Message-ID: <356F38EC.AEF725EC@ac3i.dseg.ti.com>#1/1 X-Deja-AN: 357782632 Content-Transfer-Encoding: 7bit References: <6k25ra$6j7$1@nnrp1.dejanews.com> <356B6D65.BD34E3EF@ac3i.dseg.ti.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Organization: Raytheon Systems Company, Advanced C3I Systems Newsgroups: comp.lang.ada Date: 1998-05-29T00:00:00+00:00 List-Id: Jerry van Dijk wrote: > > So perhaps you just found a new class: > > Office_Employee_List > > :-) This was offered in jest, but let's consider it seriously: One way to implement an cross-referencing association between two classes like Employee and Office could be to keep both classes ignorant of the association and just have a third class that is entirely responsible for keeping track of all the cross-references (in some sort of table structure). Yes, that is a valid design alternative, but there are tradeoffs, and it doesn't work for all applications. In particular, if Office and Employee have primitive/inheritable/overridable operations that take parameters of each other's type, then there is no way that the two classes can avoid knowing about the association. Also, this kind of cross-referencing association isn't the only way two classes might be forced into mutual dependency. My Doctors and Patients example in my FAQ didn't involve any cross-referencing between Doctor and Patient objects, but it did involve mutually-dependent primitive operations. -- Signature volanSignature = new Signature ( /*name: */ "John G. Volan", /*employer: */ "Raytheon Advanced C3I Systems, San Jose", /*workEmail: */ "johnv@ac3i.dseg.ti.com", /*homeEmail: */ "johnvolan@sprintmail.com", /*selfPlug: */ "Sun Certified Java Programmer", /*twoCents: */ "Java would be even cooler with Ada95's " + "generics, enumerated types, function types, " + "named parameter passing, etc...", /*disclaimer:*/ "These views not packaged in COM.ti.dseg.ac3i, " + "so loading them throws DontQuoteMeError. :-)" );