From: Georg Bauhaus <rm.tsoh.plus-bug.bauhaus@maps.futureapps.de>
Subject: Re: Suffix _T for types found good
Date: Thu, 07 Aug 2008 09:16:04 +0200
Date: 2008-08-07T09:16:08+02:00 [thread overview]
Message-ID: <489aa138$0$20716$9b4e6d93@newsspool4.arcor-online.net> (raw)
In-Reply-To: <594cdbb8-4018-44bd-a8db-0df3f23df247@z72g2000hsb.googlegroups.com>
amado.alves@gmail.com wrote:
> And even if you can come up with good different names for types and
> objects, even if you magically did that effortlessly, why double the
> lexicon? Can it possibly make the code better? Just to avoid a suffix
> rule?
Some points of reference for choosing names, collected
here and there. They are not perfect rules, but I
think they make sense:
- Can you answer the questions,
[a] "What kind of Node are these?" -> secific type
[b] "What kind of Node is this one?" -> specific object
A type in the sense of [a] comprises many things and
is possibly served well by a generic term. At first sight,
"Node" is such a term: assigning different meanings to "Node"
is easy. Too easy. It doesn't say what kind of Node.
In a given program's context, the nodes refer to some
larger thing of which they form part. This relation
may offer advice on chosing a qualification of Node.
A package name can serve as a qualifying addition.
There may even be another word that somehow includes
the notion of Node.
An object in the sense of [b] has identity. Identity is
usually designated by a locally unique specific name.
The name can allude to the specifics. "Central_Star" or
even "Sun" are possibly better names than just
"Celestial_Body" or "Node", I should think.
The identity can be a bit of a formal identity.
For example, a subprogram parameter name designates a
specific object during each invocation. But there are
many invocations. Each gets a different specific node.
In this case, a convention is to use the prefix
"The_" to indicate identity:
procedure Foo(The_Node: ....);
The name here expresses that Foo is going to deal with
just one node, namely The_Node. But when declaring
specific objects, e.g. nodes in certain roles,
Junction: ...;
Crossing: ...;
It seems to be tempting to just use some variation of
a type name for objects. Example:
osw: OutputStreamWriter; -- NOT!
is typical of programs targetting the JVM. So the reader
remembers that "osw" designates some output channel.
But which one? The programmer was too lazy to think of
a name. Points of reference: The purpose of this output.
Where does it end? Which ends does it connect?
next prev parent reply other threads:[~2008-08-07 7:16 UTC|newest]
Thread overview: 68+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-06 14:58 Suffix _T for types found good amado.alves
2008-08-06 16:34 ` Peter C. Chapin
2008-08-06 17:23 ` amado.alves
2008-08-06 21:57 ` Peter C. Chapin
2008-08-06 22:14 ` amado.alves
2008-08-12 14:00 ` Simon Wright
2008-08-07 1:23 ` Steve
2008-08-07 15:10 ` Colin Paul Gloster
2008-08-07 17:04 ` Ray Blaak
2008-08-07 17:19 ` amado.alves
2008-08-07 18:44 ` amado.alves
2008-08-07 19:37 ` Jeffrey R. Carter
2008-08-08 13:46 ` Steve
2008-08-08 16:40 ` Ray Blaak
2008-08-08 20:27 ` Jeffrey R. Carter
2008-08-19 18:05 ` Martin
2008-08-19 23:04 ` Ray Blaak
2008-08-20 0:13 ` Gary Scott
2008-08-20 7:42 ` What is a Contract? (was: Suffix _T for types found good) Georg Bauhaus
2008-08-20 16:19 ` Ray Blaak
2008-08-20 8:52 ` Suffix _T for types found good Martin
2008-08-20 2:01 ` Steve
2008-08-20 11:59 ` Stephen Leake
2008-08-20 14:25 ` Adam Beneschan
2008-08-20 15:38 ` Dmitry A. Kazakov
2008-08-20 20:37 ` Adam Beneschan
2008-08-21 1:46 ` Peter C. Chapin
2008-08-21 9:47 ` Stephen Leake
2008-08-21 9:49 ` Dmitry A. Kazakov
2008-08-21 9:44 ` Dmitry A. Kazakov
2008-08-22 4:12 ` Randy Brukardt
2008-08-22 4:12 ` Randy Brukardt
2008-08-20 15:46 ` Gary Scott
2008-08-21 9:48 ` Stephen Leake
2008-08-21 13:53 ` amado.alves
2008-08-21 15:30 ` Gary Scott
2008-08-20 11:53 ` Stephen Leake
2008-08-20 12:12 ` Martin
2008-08-20 19:37 ` Simon Wright
2008-08-21 9:44 ` Stephen Leake
2008-08-07 3:05 ` Randy Brukardt
2008-08-07 6:56 ` Jean-Pierre Rosen
2008-08-06 17:18 ` Niklas Holsti
2008-08-06 17:57 ` amado.alves
2008-08-06 18:43 ` Niklas Holsti
2008-08-06 19:36 ` amado.alves
2008-08-06 19:11 ` Jeffrey R. Carter
2008-08-06 19:16 ` amado.alves
2008-08-06 19:47 ` Jeffrey R. Carter
2008-08-06 20:06 ` Pascal Obry
2008-08-06 22:07 ` amado.alves
2008-08-06 23:11 ` Jeffrey R. Carter
2008-08-06 23:25 ` amado.alves
2008-08-07 7:16 ` Georg Bauhaus [this message]
2008-08-07 8:51 ` amado.alves
2008-08-07 10:10 ` Georg Bauhaus
2008-08-07 11:32 ` Georg Bauhaus
2008-08-07 12:37 ` amado.alves
2008-08-07 16:51 ` Ray Blaak
2008-08-07 17:01 ` Ray Blaak
2008-08-07 19:27 ` Adam Beneschan
2008-08-07 22:15 ` Ray Blaak
2008-08-07 22:17 ` Ray Blaak
2008-08-07 19:25 ` Jeffrey R. Carter
2008-08-07 12:12 ` Maciej Sobczak
2008-08-07 12:30 ` amado.alves
2008-08-07 12:51 ` Dmitry A. Kazakov
2008-08-07 15:37 ` amado.alves
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox