Re: Style guide for IDL? [message #31769] |
Tue, 20 August 2002 13:09 |
JD Smith
Messages: 850 Registered: December 1999
|
Senior Member |
|
|
On Tue, 20 Aug 2002 11:42:57 -0700, JD Smith wrote:
> On Tue, 20 Aug 2002 07:49:36 -0700, David Fanning wrote:
>
>> Andrew Nesbit (alnesbit@optushome.com.au) writes:
>>
>>> K&R style is arguably the most widely-seen coding style for C source
>>> code. In an analogous way, does there exist some "standard" way of
>>> writing IDL, and if so, where can I find descriptions/examples of it?
<snip>
>>
>> P.S. Let's just say I am currently working in a collaborative effort
>> with one of those damned lowercase people and he is DRIVING ME CRAZY!!!
>
> For full effect, load these texts into a
> colorizing editor like Emacs/IDLWAVE or the IDLDE.
For those of you unwilling or unable to load these into a colorizing
editor, take a look at:
http://turtle.as.arizona.edu/idlstyle.html
Let your inner aesthete guide you.
JD
|
|
|
Re: Style guide for IDL? [message #31770 is a reply to message #31769] |
Tue, 20 August 2002 12:53  |
Paul Van Delst[1]
Messages: 1157 Registered: April 2002
|
Senior Member |
|
|
JD Smith wrote:
>
> As one who is equally offended by the LOUD, PACKED WITH EXTRA
> UPPERCASE CHARACTERS, AND TANTAMOUNT TO SHOUTING AT THE READER style
> certain purveyors of the so-called truth are peddling, allow me to
> present as postscript two exhibits for your consideration. For the
> record, my ANSI-like preferences are automatically enabled using the
> following settings with IDLWAVE:
>
> idlwave-block-indent 3 ; Proper Indentation settings
> ;; Any self-respecting programmer indents his main block
> idlwave-main-block-indent 2
> idlwave-end-offset -3
> idlwave-continuation-indent 3
> idlwave-reserved-word-upcase nil ; Don't UPPERCASE reserved words
> font-lock-maximum-decoration 3
>
> Keywords, strings and other syntax elements should be set apart from
> the main body of text with color, not with LOUD UPPERCASE EMPHASIS
> WHICH REMINDS ME OF THE KIND OF EMAILS MY GRANDDAD USED TO SEND BEFORE
> HE REALIZED HOW RUDE IT IS. For full effect, load these texts into a
> colorizing editor like Emacs/IDLWAVE or the IDLDE.
>
> JD
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++
> FUNCTION FSC_PLOTWINDOW::InTarget, x, y, DIRECTION=direction
>
> ; Given a location of the cursor in the window returns the
> ; target location and the direction the window should be
> ; resized in. Have to be within 10% of window edge to be
> ; in moveable target.
> IF xtest EQ 1 AND ytest EQ 1 THEN BEGIN
> retVal = 'MOVE'
> direction = 'MOVE'
> ENDIF
................
[snip]
> vs.
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++
> function FSC_PlotWindow::InTarget, x, y, DIRECTION=direction
> ;; Given a location of the cursor in the window returns the
> ;; target location and the direction the window should be
> ;; resized in. Have to be within 10% of window edge to be
> ;; in moveable target.
> if xtest EQ 1 AND ytest EQ 1 then begin
> retVal='MOVE'
> direction='MOVE'
> endif
...............
[snip]
I prefer the first version above, except it should use
alphaImage = OBJ_NEW('IDLgrImage', alpha_image, $
DIMENSIONS=[400,400], $
INTERLEAVE=0, $
BLEND_FUNC=[3,4])
:o)
paulv
--
Paul van Delst
CIMSS @ NOAA/NCEP/EMC Beer is good.
Ph: (301)763-8000 x7274 My wife.
Fax:(301)763-8545
|
|
|
Re: Style guide for IDL? [message #31775 is a reply to message #31770] |
Tue, 20 August 2002 11:42  |
JD Smith
Messages: 850 Registered: December 1999
|
Senior Member |
|
|
On Tue, 20 Aug 2002 07:49:36 -0700, David Fanning wrote:
> Andrew Nesbit (alnesbit@optushome.com.au) writes:
>
>> K&R style is arguably the most widely-seen coding style for C source
>> code. In an analogous way, does there exist some "standard" way of
>> writing IDL, and if so, where can I find descriptions/examples of it?
>
> The IDL Expert Programmer's Association commissioned a study on this
> very topic several years ago, and the general meeting we held to discuss
> the issue was the most explosive in memory. (The ballroom had to have
> extensive repairs and a complete paint job, as I recall.)
>
> There were at least 25 different opinions from the 15 members in
> attendance, although the group could generally be divided between the
> damned lowercase fraction and the mixed-case fraction. (The ALLCAPS
> people were banished to the bar at the start of the meeting and didn't
> really cause any problems the rest of the day!)
>
> In the end, we issued a report that said, in essence, "whatever works".
> It was the most disappointed I have ever been with the EPA, because, of
> course, I am a firm believer in the Coyote Way. :-(
>
> Cheers,
>
> David
>
> P.S. Let's just say I am currently working in a collaborative effort
> with one of those damned lowercase people and he is DRIVING ME CRAZY!!!
As one who is equally offended by the LOUD, PACKED WITH EXTRA
UPPERCASE CHARACTERS, AND TANTAMOUNT TO SHOUTING AT THE READER style
certain purveyors of the so-called truth are peddling, allow me to
present as postscript two exhibits for your consideration. For the
record, my ANSI-like preferences are automatically enabled using the
following settings with IDLWAVE:
idlwave-block-indent 3 ; Proper Indentation settings
;; Any self-respecting programmer indents his main block
idlwave-main-block-indent 2
idlwave-end-offset -3
idlwave-continuation-indent 3
idlwave-reserved-word-upcase nil ; Don't UPPERCASE reserved words
font-lock-maximum-decoration 3
Keywords, strings and other syntax elements should be set apart from
the main body of text with color, not with LOUD UPPERCASE EMPHASIS
WHICH REMINDS ME OF THE KIND OF EMAILS MY GRANDDAD USED TO SEND BEFORE
HE REALIZED HOW RUDE IT IS. For full effect, load these texts into a
colorizing editor like Emacs/IDLWAVE or the IDLDE.
JD
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++
FUNCTION FSC_PLOTWINDOW::InTarget, x, y, DIRECTION=direction
; Given a location of the cursor in the window returns the
; target location and the direction the window should be
; resized in. Have to be within 10% of window edge to be
; in moveable target.
IF xtest EQ 1 AND ytest EQ 1 THEN BEGIN
retVal = 'MOVE'
direction = 'MOVE'
ENDIF
IF xtest EQ 1 AND ytest EQ 2 THEN BEGIN
retVal = 'SIZE_NS'
direction = 'N'
ENDIF
IF xtest EQ 2 AND ytest EQ 0 THEN BEGIN
retVal = 'SIZE_SE'
direction = 'SE'
ENDIF
IF xtest EQ 2 AND ytest EQ 1 THEN BEGIN
retVal = 'SIZE_EW'
direction = 'E'
ENDIF
IF xtest EQ 2 AND ytest EQ 2 THEN BEGIN
retVal = 'SIZE_NE'
direction = 'NE'
ENDIF
alphaImage = Obj_New('IDLgrImage', alpha_image, $
Dimensions=[400,400], Interleave=0, $
Blend_Func=[3,4])
RETURN, retVal
END ;----------------------------------------------------------- -----------------------
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++
vs.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++
function FSC_PlotWindow::InTarget, x, y, DIRECTION=direction
;; Given a location of the cursor in the window returns the
;; target location and the direction the window should be
;; resized in. Have to be within 10% of window edge to be
;; in moveable target.
if xtest EQ 1 AND ytest EQ 1 then begin
retVal='MOVE'
direction='MOVE'
endif
if xtest EQ 1 AND ytest EQ 2 then begin
retVal='SIZE_NS'
direction='N'
endif
if xtest EQ 2 AND ytest EQ 0 then begin
retVal='SIZE_SE'
direction='SE'
endif
if xtest EQ 2 AND ytest EQ 1 then begin
retVal='SIZE_EW'
direction='E'
endif
if xtest EQ 2 AND ytest EQ 2 then begin
retVal='SIZE_NE'
direction='NE'
endif
alphaImage=Obj_New('IDLgrImage', alpha_image, $
Dimensions=[400,400], Interleave=0, $
Blend_Func=[3,4])
return,retVal
end
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++
|
|
|
Re: Style guide for IDL? [message #31784 is a reply to message #31775] |
Tue, 20 August 2002 08:32  |
Liam E. Gumley
Messages: 378 Registered: January 2000
|
Senior Member |
|
|
Andrew Nesbit wrote:
>
> K&R style is arguably the most widely-seen coding style for C source
> code. In an analogous way, does there exist some "standard" way of
> writing IDL, and if so, where can I find descriptions/examples of it?
Here's a style guide written by Mike Schienle:
http://www.ivsoftware.com/IDL_Style.html
I've also seen an unpublished IDL style guide from Research Systems. I
may even have a copy around here somewhere...
Cheers,
Liam.
Practical IDL Programming
http://www.gumley.com/
|
|
|
Re: Style guide for IDL? [message #31785 is a reply to message #31784] |
Tue, 20 August 2002 08:09  |
notspecified
Messages: 14 Registered: February 2002
|
Junior Member |
|
|
On Tue, 20 Aug 2002 08:49:36 -0600, David Fanning <david@dfanning.com>
wrote:
> P.S. Let's just say I am currently working in a collaborative
> effort with one of those damned lowercase people and he is
> DRIVING ME CRAZY!!!
thats just silly and prejudiced im very disappointed
Matt Feinstein does not include his email address
in the text of usenet postings.
--------
Harvard Law of Automotive Repair: Anything that goes away
by itself will come back by itself.
|
|
|
Re: Style guide for IDL? [message #31788 is a reply to message #31785] |
Tue, 20 August 2002 07:49  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Andrew Nesbit (alnesbit@optushome.com.au) writes:
> K&R style is arguably the most widely-seen coding style for C source
> code. In an analogous way, does there exist some "standard" way of
> writing IDL, and if so, where can I find descriptions/examples of it?
The IDL Expert Programmer's Association commissioned a
study on this very topic several years ago, and the
general meeting we held to discuss the issue was the
most explosive in memory. (The ballroom had to have
extensive repairs and a complete paint job, as I recall.)
There were at least 25 different opinions from the
15 members in attendance, although the group could
generally be divided between the damned lowercase
fraction and the mixed-case fraction. (The ALLCAPS
people were banished to the bar at the start of the
meeting and didn't really cause any problems the rest
of the day!)
In the end, we issued a report that said, in essence,
"whatever works". It was the most disappointed I have
ever been with the EPA, because, of course, I am a firm
believer in the Coyote Way. :-(
Cheers,
David
P.S. Let's just say I am currently working in a collaborative
effort with one of those damned lowercase people and he is
DRIVING ME CRAZY!!!
--
David W. Fanning, Ph.D.
Fanning Software Consulting, Inc.
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|