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,7eaf9f2597de2259 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-10-05 06:39:38 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!canoe.uoregon.edu!hammer.uoregon.edu!skates!not-for-mail From: Stephen Leake Newsgroups: comp.lang.ada Subject: Re: on package naming, should the word "_pkg" be part of it? Date: 05 Oct 2001 09:29:31 -0400 Organization: NASA Goddard Space Flight Center Message-ID: References: <9pif1o01btl@drn.newsguy.com> <9pii95$jus$1@nh.pace.co.uk> <3bbd7a77.5463085@news.demon.co.uk> <9pk2dq01gvu@drn.newsguy.com> NNTP-Posting-Host: anarres.gsfc.nasa.gov Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: skates.gsfc.nasa.gov 1002288649 14151 128.183.220.71 (5 Oct 2001 13:30:48 GMT) X-Complaints-To: dscoggin@cne-odin.gsfc.nasa.gov NNTP-Posting-Date: 5 Oct 2001 13:30:48 GMT User-Agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7 Xref: archiver1.google.com comp.lang.ada:13781 Date: 2001-10-05T13:30:48+00:00 List-Id: mike@nospam writes: > These sorts of things are never a problem in Java. Do not see why Ada > programmers always have a problem with it. > > For example, in Java, the package java.awt.event contains these classes: > > ActionEvent > AdjusmentEvent > ComponentAdapter > ContainerAdapter > etc... So you are saying the convention in Java is to allways include some type information in the name. How do you name something that is a list of arrays of pointers to symbol table entries? > The reason to having these problems with Ada is this: In Java, each > class goes into one separate file (in general, public classes, > etc..), and in Java, a package is not a physical thing, it is the > name of the directory where the classes sit. i.e. there is no > physical file that represents a package. So what name do you give to the directory? Does it end in Package? > In Ada, many do not like a use single package file to contain 20 > tagged records declarations in the same file with all the primitive > operations on each one of those tagged record, and they want to have > a one tagged record per one package. This causes the above naming > problem. Huh? Ahh. In Java, you put many classes in one directory. Ok. In Ada, you can have many child packages of one parent package; same naming conventions. > So, I do not see why one can't do this in Ada > > package Ada.awt.event is > type ActionEvent is tagged record .... end record; > -- primitive operations on ActionEvent here > > type AdjustmentEvent is tagged record .... end record; > -- primitive operations on AdjutsmentEvent here > > type ActionEvent is tagged record .... end record; > -- primitive operations on ActionEvent here > > type ComponentAdapter is tagged record .... end record; > -- primitive operations on ComponentAdapter here > > etc... > end Ada.awt.event; Perfectly legal Ada, except that the root is 'Standard', not 'Ada'. An alternative is: package Awt.Event is end package; package Awt.Event.Actions is type Action is tagged record ... end record; end Awt.Event.Actions; etc. In Ada, you get a choice. In Java, you don't. So in that sense, Ada is harder to use, because you have to make the choice! > Using the above, will solve all these naming problem. But what it > will do, is make the java package file HUGE. It is basically like > putting all the code in those separate java class files into one big > file. Which is why Ada 95 has child packages. > This means if one modifies one line of code the package file, many > other files will have to be recompiled. No big deal, computers are > fast these days. Well, it is a big deal for other reasons as well; consider change tracking. > After all, a package should contain related types in it, and if the > package happened to have 20-30 related types, so they all go into > the same one physical file (i.e. same package). Better to put them in a package tree. -- -- Stephe