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,2078dddcdcd8d83 X-Google-Attributes: gid103376,public From: Jeff Carter Subject: Re: Warning: Religious naming convention discussion :-) [was: assign help!!] Date: 1997/05/09 Message-ID: <3373666A.31DFF4F5@spam.innocon.com>#1/1 X-Deja-AN: 240425960 References: <5kjvcv$evt@news.cis.nctu.edu.tw> <5kn8ko$jcc@top.mitre.org> <1997May7.201035.2439@nosc.mil> <33727EEA.2092@sprintmail.com> <5kuf1j$17vi@uni.library.ucla.edu> Organization: Innovative Concepts, Inc. Newsgroups: comp.lang.ada Date: 1997-05-09T00:00:00+00:00 List-Id: Jay Martin wrote: > > "John G. Volan" writes: > ... > >I only wish the original designers of Ada83 had clued into this style > >from the start. I find myself wishing Ada95 looked more like this: > > > Integer : Integer_Type; > > Natural : Natural_Type; > > Float : Float_Type; > > Boolean : Boolean_Type; > > Character : Character_Type; > > String : String_Type; > > Duration : Duration_Type; > > ... > > Two thumbs up! > > In fact wouldn't be cool if Ada forced all types to have "_Type" suffixes. > Heh probably make those C hackers blood boil. > > Jay According to my religion, you guys are heretics. I will give the command to my followers that you should be killed on sight. Now, if I only had some followers ... The problem with putting _Type on the end of all [sub]type names is that it adds no information. Almost all uses of type names make it obvious that the name is a type. So all you're doing is putting something on the end to have a different name for the type, and preserve the name for use by an object or, more typically, a subprogram parameter. So why not use the shortest possible suffix, 2 characters: _T? Because it's ugly. But it wastes fewer characters than the equally ugly _Type. The only advantage of this approach is that it's a suffix, which is much better than a prefix. In distinguishing two words, the initial characters are the most important. Two words that are the same in the initial characters and differ only in the later characters are more likely to be confused than two words that differ in the first character. Thus, the Booch school of prefixing all objects and parameters with The_ is an abomination. Now, allow me to indoctrinate you into the one true religion. Like you, I want to preserve the meaningful name (List, Queue, What_Ever) for use by objects and parameters. Unlike you, I insist that suffixes add at least some information. So I want my suffix to indicate what kind of type we're dealing with, as well as differentiating the type name. I use many; here are a few: Numeric types: _Value, _Count, _Range Enumeration types: _Id, _Name Array types: _Set, _List Record types: _Group, _Data, _Info Task types: _Agent, _Controller Private types: _Handle I'm also creative in my use of parameter names, using Into, Before, After, From, To, and so on to avoid as much of this as I can: procedure Insert (Into : in out String; Before : in Positive; Value : in String); procedure Append (Onto : in out List_Handle; After : in Position; Item : in Element); However, List_Handle is probably a protected type, so instead we can write List.Append (After : in Position, Item : in Element); Continue in your heresy, and we will burn you alive. Convert, and we will merely behead you. Ha! Nobody expects the Sappish Inquisition! -- Jeff Carter PGP:1024/440FBE21 Auntie-spam reply to; try ( carter @ innocon . com ) "Now go away, or I shall taunt you a second time." Monty Python & the Holy Grail