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,LOTS_OF_MONEY 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-15 15:52:25 PST Newsgroups: comp.lang.ada Path: archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!feed2.onemain.com!feed1.onemain.com!uunet!dca.uu.net!ash.uu.net!xyzzy!nntp From: Jeffrey Carter Subject: Re: on package naming, should the word X-Nntp-Posting-Host: e246420.msc.az.boeing.com Content-Type: text/plain; charset=us-ascii Message-ID: <3BCB65F2.225F0F42@boeing.com> Sender: nntp@news.boeing.com (Boeing NNTP News Access) Content-Transfer-Encoding: 7bit Organization: The Boeing Company X-Accept-Language: en References: <9q25ec0248o@drn.newsguy.com> <9q421v0bbg@drn.newsguy.com> <9q4a37$npd$1@nh.pace.co.uk> <9q4e59018lm@drn.newsguy.com> <9q4lje$8201@news.cis.okstate.edu> <3bc6a8ad.1988649@news.demon.co.uk> <3BC721DA.BCBC4818@boeing.com> <3bca98d8.736428@news.demon.co.uk> <%DHy7.30147$ev2.37198@www.newsranger.com> <9qfi9q01ke@drn.newsguy.com> Mime-Version: 1.0 Date: Mon, 15 Oct 2001 22:40:50 GMT X-Mailer: Mozilla 4.73 [en]C-CCK-MCD Boeing Kit (WinNT; U) Xref: archiver1.google.com comp.lang.ada:14616 Date: 2001-10-15T22:40:50+00:00 List-Id: "Robert*@" wrote: > > In article <%DHy7.30147$ev2.37198@www.newsranger.com>, Ted says... > > > >The way I was taught it, an "object" consists of a data type, together with the > >operations on that type. Since a package is one means of encapsulating both > >those things into one concept, it can indeed be considered an "object". > > > > If you "think" of a package as an object, then what do you "think" of > when you think about the tagged record inside the package? > > An object inside an object? Package-as-Object refers to a package with only subprograms visible, with the data storage in the package body. This defines an ASM. A package with a type declaration and operations on the type defines an ADT. > > What do you see when you think of an array of object? an array of packages? An object is an ASM or an instance of an ADT. An array of objects must be an array of instances of an ADT. Part of the confusion stems from 2 meanings for "type". In Ada, "type" is used for defining a set of values. For at least 30 years, the term "type" has been defined in S/W engineering to mean a set of values and the operations on those values, preferably encapsulated together, with a nice interface and unnecessary information hidden. The result is an ADT. In many languages, the Class construct provides all this. In many of those languages, the Class construct is the only construct to provide encapsulation and information hiding. In Ada, there is separation of concerns. Type declarations define sets of values, subprograms define operations on sets of values, and packages provide encapsulation, information hiding, and modularity. Thus, the combination of a type declaration and subprograms operating on that type, encapsulated in a package, defines an ADT. Since not everything that needs encapsulation and information hiding defines an ADT, and not all types need to be ADTs, the separation of concerns allows all these kinds of things. If an ADT definition contains a tagged type, then the ADT is extensible and calls to its operations may be dispatching. When extensibility is not required, the ADT may contain a non-tagged type. Those who do not recognize the special status packages have in Ada will find themselves fighting the language. In a similar manner, those who do not recognize the special status classes have in C++ will not understand the idiom of using a class to obtain encapsulation and information hiding, even though an ADT is not needed. -- Jeffrey Carter