Re: Commons, Was: can i place a job advert [message #28214 is a reply to message #28201] |
Mon, 26 November 2001 11:55   |
Paul van Delst
Messages: 364 Registered: March 1997
|
Senior Member |
|
|
Richard Younger wrote:
>
> Paul van Delst wrote:
>>
>> Well, my comment was meant to try to get those that swear profusely
>> that common blocks are a Bad Thing to explain why. I place common
>> blocks in the same category as GOTO statements - if used incorrectly
>> they can lead to unbelievably bad source code that may or may not
>> work.
>
> Well, the snooty Computer Science answer to this is that common blocks
> or global data completely separate the context of the data from its
> content. Similarly, with GOTOs, it's easy to separate the context of
> one snippet of code from another. When you have a global variable, you
> (the indefinite you, which could actually include someone else :-) )
> have no real idea what sort of code is using that data. I think the
> idea of prohibiting them is to remove the chore and responsibility of
> keeping track of the context from anyone else (or any other process of
> yours) that wanders along. It's a Good Thing(tm) when the programming
> system you use discourages methodologies that tend to cause confusion
> and mistakes.
>
> Admittedly, common blocks have some features apart from purely global
> data that discourage errors. They have to be specifically invoked, can't
> be resized (upwards), and usually IDL projects aren't so big that one
> person can't keep track of a set of well controlled commons. The
> examples given why commons in IDL specifically are bad seem to involve
> doing multiple things at the same time, or with multiple copies of the
> same program running.
This sort of usage/limitation suggests (to me) a program design flaw in that a particular
construct (common) was being used when another would do the job better. Lots of other code
constructs have this "feature" too. I'm not disagreeing with you, just stating that there are
sometimes when using a common block is called for (be it for clarity, simplicity, whatever)
despite the "snooty Computer Science" viewpoint.
> For myself, I seem to get along nicely without commons.
Me too. Haven't needed 'em since Fortran 90 introduced modules and the ability to make whatever
I wanted to be a public or private entity of that.....oops, wrong newsgroup.
> Mind you, I'm not supporting banning commons as dogma, but I think there
> are enough general objections to them to ask people to think a bit
> before they rush out and use them everywhere they can.
The important part of the above sentence is the fragment: "...ask people to think a bit..."
:o)
I particularly liked the sentence:
"It's a Good Thing(tm) when the programming system you use discourages methodologies that tend
to cause confusion
and mistakes."
If this is to be believed, pointers would never have been invented :o)
paulv
--
Paul van Delst Religious and cultural
CIMSS @ NOAA/NCEP purity is a fundamentalist
Ph: (301)763-8000 x7274 fantasy
Fax:(301)763-8545 V.S.Naipaul
|
|
|