From: Serge Robyns <serge.robyns@gmail.com>
Subject: Re: Design of cross referring types/classes and proper usage of containers
Date: Mon, 3 Aug 2015 09:14:24 -0700 (PDT)
Date: 2015-08-03T09:14:24-07:00 [thread overview]
Message-ID: <227c1c59-44b3-483a-9e90-597004a05e81@googlegroups.com> (raw)
In-Reply-To: <e83d5dc3-8044-4692-b167-da7093555648@googlegroups.com>
On Monday, 3 August 2015 18:08:17 UTC+2, Serge Robyns wrote:
> 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 aggregates.
>
> Lets use an example I've the following entity:
>
> type T_Client is tagged record -- will be mapped a table
> Id : Integer := 0;
> First_Name : T_Client_Name := T_Client_Name (P_Empty_String);
> Last_Name : T_Client_Name := 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 := No_Subscription_Name;
> Product : T_Product_Name := No_Product_Name;
> Client : T_Client := No_Client; -- Could also be of the same type T_Client.Id, used in different approach.
> Date : Ada.Calendar.Time := 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 eventually all the data will be retrieved and stored into a database. I'm planning 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 objects interacting, i.e, referring to each other. Currently I'm using the db approach, which means I use keys to search in various independant containers.
>
> But why not for example, Client that could have an Ada container of T_Subscriptions. This container could be either the object itself or a reference (access) or why not a Cursor to another Container containing all subscriptions. 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
And I forgot to mention, I'm trying to avoid access as much as possible, where it makes sense. In my C-days, I would have independant containers and use references/pointers.
next prev parent reply other threads:[~2015-08-03 16:14 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-03 16:08 Design of cross referring types/classes and proper usage of containers Serge Robyns
2015-08-03 16:14 ` Serge Robyns [this message]
2015-08-03 20:17 ` Georg Bauhaus
2015-08-03 16:22 ` Dmitry A. Kazakov
2015-08-04 11:43 ` Serge Robyns
2015-08-04 12:13 ` Dmitry A. Kazakov
2015-08-04 19:00 ` Serge Robyns
2015-08-04 19:20 ` Jeffrey R. Carter
2015-08-04 20:27 ` Randy Brukardt
2015-08-04 21:21 ` Simon Wright
2015-08-08 11:25 ` Serge Robyns
2015-08-09 3:11 ` Randy Brukardt
2015-08-09 13:33 ` Serge Robyns
2015-08-05 7:37 ` Dmitry A. Kazakov
2015-08-05 17:51 ` Serge Robyns
2015-08-05 19:21 ` Dmitry A. Kazakov
2015-08-06 7:00 ` Georg Bauhaus
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox