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,577df5d4a0e88785 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2000-12-15 07:56:02 PST Newsgroups: comp.lang.ada Subject: Re: Bad coding standards From: claveman@inetworld.net (Charles H. Sampson) Date: Fri, 15 Dec 2000 07:56:15 -0800 Message-ID: <1elo8l3.coy4nxb5upaqN%claveman@inetworld.net> References: <910u3p$v9j$1@nnrp1.deja.com> <3A3445A8.8FC404D5@acm.org> <912ut9$fga$1@nnrp1.deja.com> <3A35AFFF.CA2BA2F9@acm.org> <916gfk$e07$1@nnrp1.deja.com> <916n66$j8c$1@nnrp1.deja.com> <3A376D69.A420D711@earthlink.net> <131220001555268634%emery@mitre.org> User-Agent: MacSOUP/2.4.6 NNTP-Posting-Host: dialup1-46.inforumnet.com X-Original-NNTP-Posting-Host: dialup1-46.inforumnet.com X-Trace: 15 Dec 2000 07:55:57 -0800, dialup1-46.inforumnet.com Organization: CalWeb Internet Services Inc. Your affordable ISP. (3) X-Original-NNTP-Posting-Host: 127.0.0.1 Path: supernews.google.com!sn-xit-02!supernews.com!news-x.support.nl!colt.net!news.tele.dk!207.173.6.98!calwebnntp!calwebnnrp!claveman Xref: supernews.google.com comp.lang.ada:3171 Date: 2000-12-15T07:56:15-08:00 List-Id: David Emery wrote: > For a while, I collected coding standards as a hobby. I've > seen some dumb ideas, but here's my nomination for worst idea: > > package Long_Descriptive_Name is > > package LDN renames Long_Descriptive_Name > > type T is ... > > end Long_Descriptive_Name; > > with Long_Descriptive_Name; > package A_Client_Package is > package LDN renames Long_Descriptive_Name; > > procedure Proc (Param : LDN.T)... > > end A_Client_Package; > > In this style, the existence and use of the rename was not > an option, but was mandatory. Furthermore, there were no > rules for how a rename would be formed. In some cases, the > abbreviation related to some previous name for the package. > I once sent out a "test" with 10 abbreviations for common > packages, asking how many people recognized the renames. The > best score was 8 out of 10, and the average was about 5. > > ... Actually, I find this an acceptable compromise between my preferred style of using the use clause and the usual style of requiring fully qualified names. For me, qualifying everything with package names in- troduces a tremendous amount of clutter, particularly if the package names are long, for the occasional payoff when looking up the name is necessary. Using the two- or three-letter rename at least reduces that clutter to manageable proportions. If the abbreviations have some dis- tinguishing characteristic, such as being all upper case, then your eye can skip across them quite easily. Standard, project-wide, renames are helpful too, but that might not be practical in monstrous projects that have hundreds of packages. As Robert has pointed out, if your environment has a good browser, there's no need for these qualifications. (Quibble to follow.) I'll go a step further. If the design is good and identifiers are well chosen, you usually know the package to look at to find a declaration, although nothing tells you which lines to look at as a browser does. Quibble: None of this helps much when porting code. The browsers I'm familiar with don't work until something fully compilable is into the environ- ment. If you have compilation problem during the port, the search for identifiers can be painful. I don't understand the point of the rename in the package specifi- cation. Charlie -- To get my correct email address, replace the "claveman" by "csampson" in my fake (anti-spam) address.