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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,5394d9ca5f955366 X-Google-Attributes: gid103376,public From: Brian Rogoff Subject: Re: pointers & OOP Date: 1999/05/06 Message-ID: #1/1 X-Deja-AN: 475021657 References: <$DL10CAsSgL3Iwj3@jr-and-assoc.demon.co.uk> <7gn7gr$fr5$1@nnrp1.dejanews.com> <7gq27t$vnd$1@nnrp1.deja.com> Content-Type: TEXT/PLAIN; charset=US-ASCII X-Trace: nntp1.ba.best.com 926049972 201 bpr@206.184.139.136 MIME-Version: 1.0 Newsgroups: comp.lang.ada Date: 1999-05-06T00:00:00+00:00 List-Id: On Wed, 5 May 1999, John Robinson wrote: > In article <7gq27t$vnd$1@nnrp1.deja.com>, Robert Dewar dejanews.com> writes > >In article , > > John Robinson wrote: > > > >> Hence, a mapping from UML to Ada 95 should always map a single UML class > >> box onto a package containing a single tagged type. Although the > >> language allows multiple tagged types to be declared in a single package > >> it makes no sense whatsoever to do so. OK, you agree with Bertrand Meyer that the class is the unit of modularity I happen to think otherwise. > >This is very wrong. In fact I would say that you have essentially completely > >missed one of the most powerful features of Ada, namely that the packages > >and tagged types need NOT be in 1-1 correspondence. > > No I didn't miss this fact. I choose to implement a one-to-one mapping, > and judging by a quick review of my bookshelf I am in good company. My bookshelf says different. > >You sound like a C++ > >programmer trying to squeeze the paradigms you are used to into Ada 95 in > >an ugly and very unnatural way. I think we should stop accusing each other of being C or C++ programmers, since many professional programmers have used C and C++, and could easily qualify. Besides, Ada 95 is the only language I know in which pointers and OOP are orthogonal, so I could just as easily accuse Mr. Robinson of being an Eiffel programmer trying to do a little paradigm squeezing :-). > >Very often putting multiple types into a single package solves in a neat and > >clean way nasty problems that simply don't have neat solutions in other > >languages. > > Such as? Providing access to representation information. A good example is an iterator class or type. > The use (in general) of one "major" type per package goes back to my Well, now its become one "major" type per package. This is a lot weaker than your original claim. I might even agree with this one, and my own example clearly has the collection as the major type. A naming convention which I like, which some people find too C-ish, is to name the major type of a package "T" and the minor types things like Iterator_T or Index_T, and rely on the package name to "really" name the major type, like Lists.T, Lists.Iterator_T, etc. I still wouldn't reject a package with two symmetric (neither more major than the other), coencapsulated tagged types as being a bad design, I just can't remember having had to do that except when using access discriminants to do MI, which doesn't really count. I think your original claim about the inability to do OOP without pointers is more convincing in the weak version too, since there are some things like heterogeneous collections (in general) and access discriminant tricks (in Ada 95) that require access types, but its obvious that you can use OOP features in a pointerless program. How much OOP do you have to use for an application to be a major OOP application? -- Brian