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.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.107.11.159 with SMTP id 31mr18564332iol.21.1438618095975; Mon, 03 Aug 2015 09:08:15 -0700 (PDT) X-Received: by 10.140.22.167 with SMTP id 36mr150999qgn.4.1438618095946; Mon, 03 Aug 2015 09:08:15 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!news.glorb.com!f3no6910516igg.0!news-out.google.com!78ni4729qge.1!nntp.google.com!z61no5005267qge.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Mon, 3 Aug 2015 09:08:15 -0700 (PDT) Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=94.107.233.114; posting-account=6m7axgkAAADBKh082FfZLdYsJ24CXYi5 NNTP-Posting-Host: 94.107.233.114 User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Design of cross referring types/classes and proper usage of containers From: Serge Robyns Injection-Date: Mon, 03 Aug 2015 16:08:15 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Xref: news.eternal-september.org comp.lang.ada:27342 Date: 2015-08-03T09:08:15-07:00 List-Id: I've a design issue with regards to what is the best if not ideal approach = in building types or classes that refer to each other and could be aggregat= es. Lets use an example I've the following entity: type T_Client is tagged record -- will be mapped a table Id : Integer :=3D 0; First_Name : T_Client_Name :=3D T_Client_Name (P_Empty_String); Last_Name : T_Client_Name :=3D T_Client_Name (P_Empty_String); end record; This is to keep track of client info. I've the following other entity amongst others. type T_Subscription is tagged record -- will be mapped to a table Name : T_Subscriptiont_Name :=3D No_Subscription_Name; Product : T_Product_Name :=3D No_Product_Name; Client : T_Client :=3D No_Client; -- Could also be of the same typ= e T_Client.Id, used in different approach. Date : Ada.Calendar.Time :=3D GNAT.Calendar.No_Time; end record; And I've other entities as well that do have similar relationships. The application is keeping parts of the (static) data in memory but eventua= lly all the data will be retrieved and stored into a database. I'm plannin= g to use a design pattern (bridge or others) to implemnent this step. However, I'm wondering what would be the best Ada approach to have these ob= jects interacting, i.e, referring to each other. Currently I'm using the d= b approach, which means I use keys to search in various independant contain= ers. But why not for example, Client that could have an Ada container of T_Subsc= riptions. This container could be either the object itself or a reference = (access) or why not a Cursor to another Container containing all subscripti= ons. The same applies for the client in the subscription. And I've a few other of such entities/cases. I'm all ears to the audience experience in this matter. Regards, Serge