comp.lang.ada
 help / color / mirror / Atom feed
From: andrew <andrew.carroll@okstate.edu>
Subject: Generic Collection
Date: 8 May 2007 12:29:53 -0700
Date: 2007-05-08T12:29:53-07:00	[thread overview]
Message-ID: <1178652593.006083.173150@l77g2000hsb.googlegroups.com> (raw)

On Apr 26, 11:07 am, Georg Bauhaus <bauh...@futureapps.de> wrote:
> On Thu, 2007-04-26 at 08:31 -0700, andrew.carr...@okstate.edu wrote:
> > I discovered a possble design mistake in the program I wrote for my
> > Master's course this semester.  It's working and all that but I think
> > I could have saved myself many hours of work had I recognized (and
> > regurgitated from my undergraduate knowledge in 2002) the "is a"
> > concept.  With respect to databases a tuple "is a" collection of
> > attributes and a table "is a" collection of tuples and a schema "is a"
> > collection of tables.  I could have used a generic "collection" to
> > satisfy tuple, table and schema and I wouldn't have had to write code
> > to iterate, add, delete, etcetera from them.
>
> > Does that help explain it?
>
> Are you certain that these high level "is a" relations aren't
> entirely artificial?  What is gained by finding a thin, common
> interface of tuples, tables, and schemata?
>
> In the case you describe, I'd prefer composition over
> inheritance. A table has many tuples, and a table is part
> of a schema. So that alone makes tables collections of tuples,
> for example.
>
> By analogy, every type of a program identifies a collection of
> values. But not every type in a program must be explicitly derived
> from some universal ancestor, even when we could find some remote
> property that it shares with all other types. There is value in
> differentiating objects.
>
> Universal unification of everything leads to answers
> as useful as 42. :)

I cannot say for sure if the "is a" relations aren't entirely
artificial.  It seems to me it would work either way.  The difference
for me is that I cannot visualize the composition you mentioned.




On Apr 26, 2:40 pm, "andrew.carr...@okstate.edu"
<andrew.carr...@okstate.edu> wrote:
>
> Who said anything about derivation?  Yeah, I used the word "is a" but
> that doesn't mean I want to build a whole class tree.  As far as I am
> thinking I just do something like:  package Tuple is new
> Generic_Collection(Item => attribute);
>
> Attribute can implement some kind of file_system interface and can
> iterate by positive count values which are sequential.
>
> Then I could do package Table is new Generic_Collection(Item =>
> tuple.???);
> Then I could do package Schema is new Generic_Collection(Item =>
> table.???);
>
> This is all in a dream world so please don't get to picky with the
> syntax.  So, is there a "Generic_Collection" type of package in Ada?- Hide quoted text -
>


On Apr 26, 3:01 pm, Georg Bauhaus <bauh...@futureapps.de> wrote:
> On Thu, 2007-04-26 at 12:40 -0700, andrew.carr...@okstate.edu wrote:
> > Who said anything about derivation?  Yeah, I used the word "is a" but
> > that doesn't mean I want to build a whole class tree.
>
> Ah, OK.
>
> >   So, is there a "Generic_Collection" type of package in Ada?
>
> AFAIK, not in the sense that permits deciding the nature
> of the collection at runtime, or based on the type parameter
> (see also Dmitry's remarks).
>

So what you are saying is that the type Item in my example is the
parameter you are talking about?




             reply	other threads:[~2007-05-08 19:29 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-08 19:29 andrew [this message]
2007-05-08 21:00 ` Generic Collection Georg Bauhaus
2007-05-08 21:59   ` andrew
2007-05-09 14:51     ` andrew
2007-05-09 16:12       ` Georg Bauhaus
2007-05-09 18:54         ` andrew
2007-05-10 19:31           ` Simon Wright
2007-05-10 22:48             ` andrew
2007-05-11  8:10               ` Georg Bauhaus
2007-05-11 20:41                 ` andrew
2007-05-11 21:28                   ` Georg Bauhaus
2007-05-11 21:55                     ` andrew
2007-05-12  7:18               ` Simon Wright
2007-05-12  7:52                 ` Dmitry A. Kazakov
2007-05-13 11:00                   ` Simon Wright
2007-05-13 12:11                     ` Dmitry A. Kazakov
2007-05-16  0:27                     ` Randy Brukardt
2007-05-16  6:05                       ` Simon Wright
2007-05-16  7:17                         ` Untagged types don't work right - was: " Grein, Christoph (Fa. ESG)
2007-05-16 13:27                       ` Benjamin Place
2007-05-14 17:09                 ` andrew
2007-05-14 20:00                   ` Simon Wright
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox