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,86a457a80a9f4412,start X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!l77g2000hsb.googlegroups.com!not-for-mail From: andrew Newsgroups: comp.lang.ada Subject: Generic Collection Date: 8 May 2007 12:29:53 -0700 Organization: http://groups.google.com Message-ID: <1178652593.006083.173150@l77g2000hsb.googlegroups.com> NNTP-Posting-Host: 139.78.128.110 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1178652593 13277 127.0.0.1 (8 May 2007 19:29:53 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 8 May 2007 19:29:53 +0000 (UTC) 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: l77g2000hsb.googlegroups.com; posting-host=139.78.128.110; posting-account=Kq9unQ0AAADh_grEViI3JGqegXKDDjxt Xref: g2news1.google.com comp.lang.ada:15655 Date: 2007-05-08T12:29:53-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. :) 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" 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 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?