Re: Global variables and IDL [message #14979 is a reply to message #11537] |
Wed, 14 April 1999 00:00   |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
Rose (rmlongfield@my-dejanews.com) writes:
> My problem is that this tool of mine is getting rather complicated (read:
> messy) and I have three WIDGET_CONTROL, GET_UVALUE statements at the
> beginning of many of my event handlers, because I have several info pointers
> which hold information that I need. (One each from the event ID, top and main
> info) Maybe I am just dis-organized, but it seems to be getting out of hand.
Humm. I've been there before too. And to tell you the truth, I've
even thought about COMMON blocks a time or two. (I never told
anyone COMMON blocks are evil. I've just tried to live my
life as if they were. :-)
But in the end I just either reorganized my program (usually with
some kind of object at the heart of it) or I just turned the whole
mess over to Dick, who is far and away the better programmer, and
went back to work on the theory section of my damn book. :-(
> I am wondering whether using a COMMON statement for a set of
> variables or data arrays that aren't changing would not be such a bad idea.
> What about using constants such as PI or earth radius? Where can they be
> defined once and then used throughout a program ? I am considering putting
> my data in a COMMON statement so that I can get to it in an easy way (i.e.
> without (*(*infoPtr).dataArrPtr) type statements all over the place)
I'm sympathetic. I really am. I'm more sympathetic to constants. (PI by
the way is available via a system variable.) I'm really loath to put
data in common because then you really do lose the ability to use
more than one instance of your program at a time. On the other hand,
how many versions of a program like ENVI do you really want running?
> It is this or re-writing the tool from scratch (which it really needs if only
> I could find the time).
My daddy used to say, "No time to do it right. Plenty of time
to do it over." :-)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|