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-Thread: 103376,2a687662f09731bb X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx01.iad01.newshosting.com!newshosting.com!130.81.64.211.MISMATCH!cycny01.gnilink.net!cyclone1.gnilink.net!spamkiller.gnilink.net!gnilink.net!trnddc06.POSTED!20ae255c!not-for-mail Newsgroups: comp.lang.ada From: Anonymous Coward Subject: Re: Ada Quality and Style book discussion References: Message-Id: User-Agent: slrn/0.9.7.4 (Linux) Date: Thu, 17 Nov 2005 04:49:09 GMT NNTP-Posting-Host: 141.149.78.234 X-Complaints-To: abuse@verizon.net X-Trace: trnddc06 1132202949 141.149.78.234 (Wed, 16 Nov 2005 23:49:09 EST) NNTP-Posting-Date: Wed, 16 Nov 2005 23:49:09 EST Xref: g2news1.google.com comp.lang.ada:6439 Date: 2005-11-17T04:49:09+00:00 List-Id: In article , Martin Dowie wrote: > > I'm with Simon on this one. "Today" or "This_Day" or "The_First_Day" > are better variable names... "Today" and "The_First_Day" are better variable names if the objects really have those meanings; but "This_Day" is lousy, because any noun (and non-boolean objects should be nouns) can follow "This_", which is completely meaningless. "_Type" is meaningful, because it indicates a user defined type. "A_" and "An_" is almost as meaningless as "This_", because *most* objects in a system are singular. It's far less noise to make plural objects to stand out by adding an "s" or "_Array" or "_List". > ...however, there are times when there are name clashes and (for no > good reason that I can think of) Ada can't tell the difference > between a types name and, say, an enumerate. > > So, instead of appending the ugly "_Type", I prefer to use the > English as my inspiration and prefix "A_" or "An_". Types are after > all "indefinite articles". Objects are "definite articles". > > E.g. > > My_New_Saab : A_Car; > > Which can be read "My new Saab is a Car". The project I worked on that banned "_Type" also tried to encourage developers to choose identifiers that make a complete grammatically correct english sentence, as if it were more important that non-technical folks could read the code than the maintainers. It didn't work out too well, because when you make an english sentence in one usage, the same identifers make the code look like crap where an english sentence doesn't exist. ie. function compute_altitude (using : in temperature; and : in dew_point; with : in pressure) return altitude is begin return (using + and / with); end compute_altitude; Obviously that's a bogus formula.. but it should be clear from this that making code read like english down to the point of including articles like "and", "with", "is", asks for disaster. Some folks really complied with this direction, and wrote code like that function above - I'm not joking.