Re: detect Inf or NaN
- From: "James Giles" <jamesgiles@xxxxxxxxxxxxxxxx>
- Date: Sun, 28 Oct 2007 05:56:30 GMT
Craig Dedo wrote:
"James Giles" <jamesgiles@xxxxxxxxxxxxxxxx> wrote in message....
news:CoPUi.286689$ax1.162980@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Of course, the names shouldn't have been so verbose in the first
place. You know they're IEEE functions because of the MODULE
you got them from. You don't need them to carry around that
information in their names.
I strongly disagree. The names of the IEEE procedures and other
named thingos are excellent examples of proper naming practices. They
follow all of the criteria of recommended best practices for
good names. One software development standard, the _OpenVMS
Programming Concepts_ manual, specifically recommends that procedures
that conceptually belong together should share a common prefix. In
OpenVMS terminology, this conceptual grouping is called a "facility".
Each facility in a particular organization should have a unique
prefix and all procedure names should start with the facility prefix.
Excellent advice for languages like C where there are no module
facilities. Indeed, things in Fortran - like external procedures,
COMMON block names, and MODULE names should do so as
well. I can well remember the trouble of designing proper
naming conventions for programs given that procedures and
common blocks were limited to 6 character names. The advice
that things filling up the global namespace need to be carefully
named is hardly a newsflash.
But the contents of a MODULE don't reside in the global namespace.
The issues important for the selection of their names are different.
I mentioned Steve McConnell's _Code Complete: A Practical Handbook
of Software Construction_ yesterday in a different thread. Both
editions of this book have extensive discussions of recommended
practices for choosing good names. They are in 1st ed., ch. 9, "The
Power of Data Names" and 2nd ed., ch. 11, "The Power of Variable
Names". For procedure names, see also 1st ed., sec. 5.2 and 2nd ed., sec.
7.3.
And this was a book written specifically with *Fortran* in mind? Or
is it advice more relevant to writers of languages like C (where it's
valid advice indeed). To be sure, names should be mnemonic for the
thing they name. In a modular language that usually shouldn't need to
include where they came from. It is certainly the case that how you
write a code for legibility depends a lot on the features and syntax
of the target language. There's no "one size fits all" advice for most
programming issues - including variable naming conventions.
You are also assuming that the source code that references the procedure
names is close to the USE statement for one of the IEEE modules.
Actually I wasn't assuming that. I was assuming that, once ISNAN
is available within the standard I'll not be using any other one.
So, I won't have any difficulty telling what ISNAN is in use no matter
how far from the declarations I get. Ad-hoc tests for ISNAN will
have long been consigned to /dev/null.
Like all forms of communication what you should be concerned with
is what you are trying to tell your reader (listener), and what you can
assume that person already knows. If you keep telling your audience
things already known they tend to tune you out. It's a good idea to
avoid that. This also explains why this very thread is discussing
ways to give these things more manageable names.
[...] Properly written
procedures can run to several pages. [...] Add in data
declarations and proper use of comments and a properly written
procedure could run to 6 - 8 pages.
I wonder how long they'd be if proper length names were used?
:-)
--
J. Giles
"I conclude that there are two ways of constructing a software
design: One way is to make it so simple that there are obviously
no deficiencies and the other way is to make it so complicated
that there are no obvious deficiencies." -- C. A. R. Hoare
.
- Follow-Ups:
- Re: detect Inf or NaN
- From: Paul van Delst
- Re: detect Inf or NaN
- From: Craig Dedo
- Re: detect Inf or NaN
- References:
- detect Inf or NaN
- From: Diego . Virasoro
- Re: detect Inf or NaN
- From: dpb
- Re: detect Inf or NaN
- From: dpb
- Re: detect Inf or NaN
- From: Chip Coldwell
- Re: detect Inf or NaN
- From: dpb
- Re: detect Inf or NaN
- From: Richard Maine
- Re: detect Inf or NaN
- From: glen herrmannsfeldt
- Re: detect Inf or NaN
- From: Richard Maine
- Re: detect Inf or NaN
- From: James Giles
- Re: detect Inf or NaN
- From: Craig Dedo
- detect Inf or NaN
- Prev by Date: Re: detect Inf or NaN
- Next by Date: Re: spawing multiple threads in Compaq Fortran?
- Previous by thread: Re: detect Inf or NaN
- Next by thread: Re: detect Inf or NaN
- Index(es):
Relevant Pages
|