comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Namespaces (redux)
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Namespaces (redux) [message #32224 is a reply to message #32223] Wed, 25 September 2002 08:06 Go to previous messageGo to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
JD Smith <jdsmith@as.arizona.edu> writes:
> This brings up an excellent point that probably needs reiterating: the IDL
> namespace is a rapidly dwindling resource, as libraries grow and
> disseminate. While in the past most IDL users might have worked primarily
> with their own routines, with a few bits and pieces of outside code
> cobbled together from various sources, that era seems to be passing, given
> the improving quality and availability of large libraries, and the new RSI
> initiative to facilitate code sharing among IDL users. What can we do to
> preserve this vanishing resource? A few guidelines come to mind:

JD, I think you are being a bit too alarmist. The IDL namespace is
not rapidly dwindling the same way that (pick favorite species) are
declining. For a typical 10-character function name, there are about
a million billion unique combinations. Of course, if we restrict to
English-sounding names, then the unique combinations is less, but
still huge.

Still, I agree with several of your points, just at a philosophical
level:

> 2. If not using objects, imitate their namespace parsimony by
> consistently prepending a class-like prefix to all related routines...
> e.g. tvRubberBandBoxDisplay.pro, or tvRBandBox_display.

Yes, this is a must, at least for routines in the same file.


> 4. Make qualifying prefixes descriptive and unique. Using initials
> as qualifiers is of course an option, but wastes precious filename
> space on information of little real value. If you do use initials,
> don't skimp on additional information in the rest of the name.

I'm not sure it's of little real value. For example, from the names
REPLICATE and CMREPLICATE, you can probably guess that both do
something similar.

Or, the names of functions MPFIT, MPFITFUN, MPFITEXPR, MPFITPEAK, and
so on, indicate that they all belong to the same library, obey the
same calling conventions, and that is valuable knowledge. [ And pays
homage to the MINPACK heritage. ]

I'm not a huge fan of typing routine names like
tvRubberBandBoxUpdatePanelWithMarchingAnts().


> 5. Look before you leap. An excellent (if increasingly outdated)
> online-browser for almost all widely distributed libraries of IDL code
> is available at:


Now here is the crux of the matter. The reason that we have name
clashes is that everybody and their brother has written *slightly
different* routines to count lines in files, called it the same thing,
and published it. However, most people are respectful. If you search
the IDL Astronomy library or the U. Washington index for terms like
FIT or LEGENDRE, you will find lots of routines, but they are for the
most part unique. Rule: If it's an *obvious* name, then attach a
*non* obvious prefix or suffix to the name. End of story.

It is notable that in almost every case, the offending entity for
these types of namespace clashes is none other than Research Systems
Incorporated. We should be preaching to them.

Yours,
Craig


My addition: I attempt to always keep the main routine name unique
within the first 8 characters from all other routines I know about.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: mpeg
Next Topic: Re: 24-bit color on printer device

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 15:12:18 PDT 2025

Total time taken to generate the page: 0.48172 seconds