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!news4.google.com!newshub.sdsu.edu!elnk-nf2-pas!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!newsread1.news.pas.earthlink.net.POSTED!a6202946!not-for-mail From: "Jeffrey R. Carter" Organization: jrcarter at acm dot org User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.12) Gecko/20050915 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Ada Quality and Style book discussion ("_Type" suffix) References: In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Message-ID: Date: Sun, 20 Nov 2005 19:41:05 GMT NNTP-Posting-Host: 67.3.221.121 X-Complaints-To: abuse@earthlink.net X-Trace: newsread1.news.pas.earthlink.net 1132515665 67.3.221.121 (Sun, 20 Nov 2005 11:41:05 PST) NNTP-Posting-Date: Sun, 20 Nov 2005 11:41:05 PST Xref: g2news1.google.com comp.lang.ada:6506 Date: 2005-11-20T19:41:05+00:00 List-Id: Anonymous Coward wrote: > Suffixes are *very* useful, as I will illustrate. It's no coincidence > that well named, direct, concise type names very often match > (verbatim) good names for objects (including enums), in the absense of > a type suffix. GOOD suffixes are very useful. _Type is a bad suffix. As AC himself says elsewhere, "If you're repeating information from your declaration in your identifiers, then you've created a maintenance problem by introducing too much noise". "type X_Type" clearly repeats information from the declaration in the identifier. Prefixes are very bad. The 1st few characters of an identifier are the most important in determining what it is. If lots of identifiers start with the same sequence of characters, it makes reading harder. My personal preferences are > type Day is (Monday, Tuesday, Wednesday, Thursday, Day_ID > type Meters is new Float; Meter_Value > type Feet is new Float; Foot_Value > type Length is (Feet, Meters, Miles); Length_ID > Speed : Speed; Global variables are extremely bad. But consider procedure P (Speed : in Speed_Value); In well designed systems, packages tend to contain a type and operations on that type; objects of the type are generally declared elsewhere, and in any case represent specific things, not the general concept of the type, so the issue rarely comes up. That said, I've worked on projects where _Type was mandated, and it works reasonably well. I got irritated every time I typed _Type, but the resulting code was readable. -- Jeff Carter "I'm a kike, a yid, a heebie, a hook nose! I'm Kosher, Mum! I'm a Red Sea pedestrian, and proud of it!" Monty Python's Life of Brian 77