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,63a41ccea0fc803a X-Google-Attributes: gid103376,public From: Matthew Heaney Subject: Re: Naming of Tagged Types and Associated Packages Date: 1998/07/25 Message-ID: #1/1 X-Deja-AN: 374850671 Sender: matt@mheaney.ni.net References: NNTP-Posting-Date: Sat, 25 Jul 1998 10:48:31 PDT Newsgroups: comp.lang.ada Date: 1998-07-25T00:00:00+00:00 List-Id: taashlo@sandia.SPAMFREE.gov writes: > In the _Ada 95 Quality and Style_ guidelines, section 3.2.4 "Naming of > Tagged Types and Associated Packages", there are two instantions. One > integrates the use of object-oriented features. The other highlights > the use of object-oriented features. Could somebody please give a > summary of the strengths and weaknesses of each? And maybe an example > of where one convention would be more appropriate than the other? Here are a few ideas: 1) Name the package using the plural of the (tagged on non-tagged) type it exports: package Bank_Accounts is type Bank_Account is tagged limited private; ... end Bank_Accounts; If you export more the one ADT, then the package name should conver the theme of the types; it may be just the plural of the root of a type hierarchy: package Computer_Equipment is type Root_Equipment is tagged private; type CD_ROM is new Root_Equipment with private; type Floppy_Disk is new Root_Equipment with private; type Hard_Drive is new Root_Equipment with private; ... end Computer_Equipment; 2) Name the type with a noun phrase: type Root_Equipment is tagged private; type Bank_Account is tagged private; type File_Type is private; 3) If you have a type hierarchy, and you want to put the derived types in different package, then put the types in child packages of the package that declares the root type. Name the child packages using the adjective used to name the derived type: package Bank_Accounts.Checking is type Checking_Account is new Bank_Account with private; ... package Bank_Accounts.Savings is type Savings_Account is new Bank_Account with private; ... And whatever you do, please do NOT name a type "Object" or "Instance". This is a sure sign of confusion about the difference between a module and a type, which are orthogonal language features in Ada.