comp.lang.ada
 help / color / mirror / Atom feed
From: Jeffrey Carter <spam@spam.com>
Subject: Re: A good way to name instantiated children?
Date: Sat, 21 Jun 2003 19:43:54 GMT
Date: 2003-06-21T19:43:54+00:00	[thread overview]
Message-ID: <3EF4B565.6070907@spam.com> (raw)
In-Reply-To: x7vvfv0vsbz.fsf@smaug.pushface.org

Simon Wright wrote:
> Stephen Leake <Stephe.Leake@nasa.gov> writes:
> 
>>I solve this by prefixing Gen_ to the generic package names:
> 
> I've used the suffix _G (still in >1 mind about it, though!)

The name of generic should relate to the thing it implements; the name 
of the instantiation, the application's need for such a thing. Coming up 
with good names for instantiations is an important part of making the 
S/W as self-documenting as possible.

As an example, the data structures in the PragmAda Reusable Components 
have generic procedures named Iterate. Instantiations should have names 
like Put_All, Sum, and so on, indicating what the application achieves 
by visiting each element in the structure. An instantiation named 
Iterate would not be properly descriptive.

If you are going to repeat "generic" in the name, a suffix is better 
than a prefix. Psychologically, the 1st few characters of identifiers 
are the most important in distinguishing them. If you have a lot of 
identifiers starting with the same thing, it makes your code harder to 
read. This applies to A_ and The_ on parameter names as well as to Gen_ 
on generics.

-- 
Jeff Carter
"If a sperm is wasted, God gets quite irate."
Monty Python's the Meaning of Life




  reply	other threads:[~2003-06-21 19:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-06-20 15:51 A good way to name instantiated children? Dmitry A. Kazakov
2003-06-20 21:06 ` Stephen Leake
2003-06-21  6:48   ` Simon Wright
2003-06-21 19:43     ` Jeffrey Carter [this message]
2003-06-23 13:39       ` Stephen Leake
2003-06-21  7:12   ` Dmitry A. Kazakov
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox