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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no 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!news2.volia.net!newsfeed01.sul.t-online.de!t-online.de!newsfeed.arcor.de!news.arcor.de!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Ada Quality and Style book discussion ("_Type" suffix) Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.14.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: Date: Sun, 20 Nov 2005 21:43:07 +0100 Message-ID: NNTP-Posting-Date: 20 Nov 2005 21:43:06 MET NNTP-Posting-Host: 94ba0d72.newsread2.arcor-online.net X-Trace: DXC=i1X6clY]0mWTkno\?fPDcVQ5U85hF6f;TjW\KbG]kaMXA@_25la3nbRj011FhVnIQY[6LHn;2LCV^[ On Sun, 20 Nov 2005 19:41:05 GMT, Jeffrey R. Carter wrote: > 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. True, Hungarian notation is bad. > 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. Yes, prefix Hungarian notation is worse than bad. > My personal preferences are > >> type Day is (Monday, Tuesday, Wednesday, Thursday, > > Day_ID Is Monday an ID? >> type Meters is new Float; > > Meter_Value Type is a value, how so? Meter_Value is something like 1000mm, or the length of that metal bar somewhere in Paris (I guess), or the distance traveled by light in vacuum during a time interval of 1/299 792 458 of a second... (:-)) I would prefer type Metric_Distance is new Float; if it is necessary to underline that the distance is measured in meters. > procedure P (Speed : in Speed_Value); procedure P (Speed_Value : in Speed); I presume. But better is: procedure P (Value : in Speed); -------------- The problem is that both type and variable of are meant to identify the same thing: a set of values. When an object is declared one can try to name it in a way that would reflect the specific value it represents: Today : Day; Tomorrow : Day; With subroutine parameters it gets difficult. More abstract they are more difficult is to find a name reflecting the problem space. In the end it becomes: Value, Index, I, J, K, X, Y, Left, Right, Result etc. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de