comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Wright <simon@pushface.org>
Subject: Re: Design of cross referring types/classes and proper usage of containers
Date: Tue, 04 Aug 2015 22:21:44 +0100
Date: 2015-08-04T22:21:44+01:00	[thread overview]
Message-ID: <lyio8u3g2f.fsf@pushface.org> (raw)
In-Reply-To: 3341271b-4926-40cb-a9aa-660522d56f24@googlegroups.com

Serge Robyns <serge.robyns@gmail.com> writes:

> Shall I Storing the full element of objects or references created
> through new T_xyz

The objects should be limited, in Ada terms; you don't want a copy of a
subscription in a client object (in general; I guess if subscriptions
have no other relationships .. well, no, a <thing that is subscribed to>
- say, Mailing_List - will in general have many subscribers, and a
client will have many subscriptions). In general I'd keep Clients as
elements in a Map keyed by client_ID, likewise Mailing_Lists. The
limited object in the Map *is* the Client, you can't copy it out and
risk confusing the copied info with the thing itself.

I'd try to implement a Subscription as a record containing a client_ID
and a mailing_list_ID and any supplementary data (renewal date, discount
rate ...), and keep them in a Subscription container (classic database
stuff). This does leave you to work out how to get efficient access from
a specific Client to all the Mailing_Lists that they subscribe to, and
vice versa, and you might want to optimise a bit.

  parent reply	other threads:[~2015-08-04 21:21 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
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 [this message]
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