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 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,229ea0001655d6a2 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!o40g2000prh.googlegroups.com!not-for-mail From: "andrew.carroll@okstate.edu" Newsgroups: comp.lang.ada Subject: Re: Generic Package Date: 26 Apr 2007 12:40:00 -0700 Organization: http://groups.google.com Message-ID: <1177616400.352571.308890@o40g2000prh.googlegroups.com> References: <1177539306.952515.222940@s33g2000prh.googlegroups.com> <1177601484.444701.171560@r35g2000prh.googlegroups.com> <1177603644.24583.15.camel@localhost.localdomain> NNTP-Posting-Host: 139.78.128.110 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1177616412 23359 127.0.0.1 (26 Apr 2007 19:40:12 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 26 Apr 2007 19:40:12 +0000 (UTC) In-Reply-To: <1177603644.24583.15.camel@localhost.localdomain> User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; InfoPath.1; .NET CLR 1.1.4322),gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: o40g2000prh.googlegroups.com; posting-host=139.78.128.110; posting-account=Kq9unQ0AAADh_grEViI3JGqegXKDDjxt Xref: g2news1.google.com comp.lang.ada:15319 Date: 2007-04-26T12:40:00-07:00 List-Id: On Apr 26, 11:07 am, Georg Bauhaus 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. :) 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?