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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,dfe340a115a0bc1,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2004-02-03 15:52:30 PST Path: archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newshosting.com!nx02.iad01.newshosting.com!yellow.newsread.com!netaxs.com!newsread.com!newsstand.newsread.com!POSTED.monger.newsread.com!not-for-mail From: Peter C. Chapin Newsgroups: comp.lang.ada Subject: Naming convention for classes? Message-ID: Organization: Kelsey Mountain Software X-Newsreader: MicroPlanet Gravity v2.50 Date: Tue, 03 Feb 2004 23:52:28 GMT NNTP-Posting-Host: 216.114.161.222 X-Complaints-To: Abuse Role , We Care X-Trace: monger.newsread.com 1075852348 216.114.161.222 (Tue, 03 Feb 2004 18:52:28 EST) NNTP-Posting-Date: Tue, 03 Feb 2004 18:52:28 EST Xref: archiver1.google.com comp.lang.ada:5203 Date: 2004-02-03T23:52:28+00:00 List-Id: I'm a C++ person learning my way around Ada. Naturally I tend to think about things in a C++ way and that leads me to various questions. I notice, for example, that there seems to be two (at least) somewhat different ways to name classes in Ada. The first way gives the class name to a package producing the following effect. package Date is type Object is private; procedure Advance(Item : in out Object; Step : in Integer); ... end Date; The I can create Date objects by first withing Date and then doing Today : Date.Object; ... Date.Advance(Today, 100); Another approach would be to give the type itself the "nice" name and regard the package name as "noise" used to avoid name clashes in large programs. For example package My_Library is type Date is private; procedure Advance(Item : in out Date; Step : in Integer); ... end My_Library; Then I might with My_Library and use My_Library and do Today : Date; ... Advance(Today, 100); The second approach seems natural but I notice that the Charles component library uses the first approach and it seems to work well in that case. For example, in my program I do package Vector is new Charles.Vectors.Unbounded( Index_Type => Natural, Element_Type => Storage_Type); Then I declare things to be Vector.Container_Type and use procedures like Vector.Append and Vector.Insert, etc. Now I'm building my own abstract type and I find myself waffling... should I use my intended name for the package or for a type inside the package? Is there some kind of "best practice" for this? Or am I off in the weeds here? Thanks! Peter