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

Home » Public Forums » archive » Re: Comments on Coding Style
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Comments on Coding Style [message #70668] Thu, 29 April 2010 13:59 Go to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Mike Galloy writes:

>>> Also, using one of the standard formats allows the Workbench to show
>>> the help for the routine.
>>
>> How is this done?
>
> Nothing needs to be done to turn it on, just write the comments in
> IDLdoc's rst format.

But how is this accessed from the Workbench?

Cheers,

David



--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thue. ("Perhaps thos speakest truth.")
Re: Comments on Coding Style [message #70669 is a reply to message #70668] Thu, 29 April 2010 13:52 Go to previous messageGo to next message
Michael Galloy is currently offline  Michael Galloy
Messages: 1114
Registered: April 2006
Senior Member
On 4/29/10 1:42 PM, David Fanning wrote:
> pp writes:
>
>> Also, using one of the standard formats allows the Workbench to show
>> the help for the routine.
>
> How is this done?

Nothing needs to be done to turn it on, just write the comments in
IDLdoc's rst format. To get started on using IDLdoc including what rst
format comments look like, see:

http://idldoc.idldev.com/wiki/GettingStarted

More details on what the allowable tags are is embedded in the help page
of any IDLdoc output, for example:

http://docs.idldev.com/idllib/idldoc-help.html

I need to make a friendlier guide sometime, but I think all the
information is on these pages.

Mike
--
www.michaelgalloy.com
Research Mathematician
Tech-X Corporation
Re: Comments on Coding Style [message #70670 is a reply to message #70669] Thu, 29 April 2010 13:17 Go to previous messageGo to next message
Aram Panasenco is currently offline  Aram Panasenco
Messages: 41
Registered: April 2010
Member
pp wrote:
> On Apr 29, 4:26 pm, Aram Panasenco<panasencoa...@gmail.com> wrote:
>> I am going to try and use only one header per class that will describe
>> the entire class interface. I am using non-standard tags (Name, Design
>> Details, Abstraction, Syntax, and Public Methods) instead of the more
>> standard (Name, Purpose, Category, Superclasses, Subclasses, Syntax). Is
>> that a bad change? What would you like to see different about the header?
>
> If you use one of the standard formats (and tags) for the comments,
> then you can use IDLdoc to generate nice documentation pages (which
> include very useful features like links and search). If you are not
> familiar with it, see
>
> http://idldoc.idldev.com/
>
> Also, using one of the standard formats allows the Workbench to show
> the help for the routine.

Actually, I have just explored more of IDLdoc and I think it has some
pretty good standards. Maybe I will switch to documenting each routine
by them. I will see. Thanks again for the info!

~Aram Panasenco
Re: Comments on Coding Style [message #70671 is a reply to message #70670] Thu, 29 April 2010 13:10 Go to previous messageGo to next message
Aram Panasenco is currently offline  Aram Panasenco
Messages: 41
Registered: April 2010
Member
pp wrote:
> On Apr 29, 4:26 pm, Aram Panasenco<panasencoa...@gmail.com> wrote:
>> I am going to try and use only one header per class that will describe
>> the entire class interface. I am using non-standard tags (Name, Design
>> Details, Abstraction, Syntax, and Public Methods) instead of the more
>> standard (Name, Purpose, Category, Superclasses, Subclasses, Syntax). Is
>> that a bad change? What would you like to see different about the header?
>
> If you use one of the standard formats (and tags) for the comments,
> then you can use IDLdoc to generate nice documentation pages (which
> include very useful features like links and search). If you are not
> familiar with it, see
>
> http://idldoc.idldev.com/
>
> Also, using one of the standard formats allows the Workbench to show
> the help for the routine.

I have just checked out IDLdoc and... wow! I am downright speechless. It
does generate amazing help pages. I am sure there is a way to fine-tune
it (or downright modify the source code) to work with nonstandard tags,
though. Right now, human readability is a bigger concern for me.

~Aram Panasenco
Re: Comments on Coding Style [message #70673 is a reply to message #70671] Thu, 29 April 2010 12:42 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
pp writes:

> Also, using one of the standard formats allows the Workbench to show
> the help for the routine.

How is this done?

Cheers,

David



--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thue. ("Perhaps thos speakest truth.")
Re: Comments on Coding Style [message #70674 is a reply to message #70673] Thu, 29 April 2010 12:38 Go to previous messageGo to next message
penteado is currently offline  penteado
Messages: 866
Registered: February 2018
Senior Member
Administrator
On Apr 29, 4:26 pm, Aram Panasenco <panasencoa...@gmail.com> wrote:
> I am going to try and use only one header per class that will describe
> the entire class interface. I am using non-standard tags (Name, Design
> Details, Abstraction, Syntax, and Public Methods) instead of the more
> standard (Name, Purpose, Category, Superclasses, Subclasses, Syntax). Is
> that a bad change? What would you like to see different about the header?

If you use one of the standard formats (and tags) for the comments,
then you can use IDLdoc to generate nice documentation pages (which
include very useful features like links and search). If you are not
familiar with it, see

http://idldoc.idldev.com/

Also, using one of the standard formats allows the Workbench to show
the help for the routine.
Re: Comments on Coding Style [message #70675 is a reply to message #70674] Thu, 29 April 2010 12:26 Go to previous messageGo to next message
Aram Panasenco is currently offline  Aram Panasenco
Messages: 41
Registered: April 2010
Member
David Fanning wrote:
> Aram Panasenco writes:
>
>> I want your comments on the programming conventions I use and how I can
>> change them to make the code more clear and desirable for other
>> programmers to improve. Some things to consider:
>>
>> - Should I use comments or is the code (so far) pretty self-explanatory?
>> - Is the non-standard capitalization annoying you? Should I switch to
>> the classic IDL capitalization (All-caps for IDL keywords, capitalized
>> function and procedure names)?
>> - Is there anything wrong with the way I handle the IDL class? The
>> routines?
>> - Anything wrong at all? I'd rather fix it now than thousands of lines
>> of code later.
>
> I like the style, but, yes, you need comments. Lots of
> them. :-)
>
> Also, the __DEFINE method has to be the *last* method
> in the file, not the first, or you will spend all your
> programming time compiling files as if you were programming
> in C or something. :-)
>
> http://www.dfanning.com/tips/namefiles.html
>
> Cheers,
>
> David
>
>
>

Thank you Maarten and David for your comments ;)

I have followed your advice and added comments, added a header, and
moved the __DEFINE method to the bottom of the file. That means I am now
going to need more criticism about these things.

I am going to try and use only one header per class that will describe
the entire class interface. I am using non-standard tags (Name, Design
Details, Abstraction, Syntax, and Public Methods) instead of the more
standard (Name, Purpose, Category, Superclasses, Subclasses, Syntax). Is
that a bad change? What would you like to see different about the header?

Are the comments describing the intention of the code rather than
repeating it? Are the comments distracting, are there too many or too
little?

Class:

http://pastebin.com/QuNuMKwu
Re: Comments on Coding Style [message #70684 is a reply to message #70675] Thu, 29 April 2010 06:05 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Aram Panasenco writes:

> I want your comments on the programming conventions I use and how I can
> change them to make the code more clear and desirable for other
> programmers to improve. Some things to consider:
>
> - Should I use comments or is the code (so far) pretty self-explanatory?
> - Is the non-standard capitalization annoying you? Should I switch to
> the classic IDL capitalization (All-caps for IDL keywords, capitalized
> function and procedure names)?
> - Is there anything wrong with the way I handle the IDL class? The
> routines?
> - Anything wrong at all? I'd rather fix it now than thousands of lines
> of code later.

I like the style, but, yes, you need comments. Lots of
them. :-)

Also, the __DEFINE method has to be the *last* method
in the file, not the first, or you will spend all your
programming time compiling files as if you were programming
in C or something. :-)

http://www.dfanning.com/tips/namefiles.html

Cheers,

David



--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: Comments on Coding Style [message #70693 is a reply to message #70684] Thu, 29 April 2010 01:44 Go to previous messageGo to next message
Maarten[1] is currently offline  Maarten[1]
Messages: 176
Registered: November 2005
Senior Member
On Apr 29, 8:26 am, Aram Panasenco <panasencoa...@gmail.com> wrote:


> I want your comments on the programming conventions I use and how I can
> change them to make the code more clear and desirable for other
> programmers to improve. Some things to consider:
>
> - Should I use comments or is the code (so far) pretty self-explanatory?

Always add a description of hte intention of the code. Not the trivial
bits ("increment var by 1" is pointless, adding a comment _why_ var is
incremented can save you a lot of headaches). This code was not self-
explanatory for me.

> - Is the non-standard capitalization annoying you? Should I switch to
> the classic IDL capitalization (All-caps for IDL keywords, capitalized
> function and procedure names)?

I'm more annoyed by the over-capitalization of classic IDL. All-caps
is like shouting all the time, and at some point I stop listening. An
editor with syntax coloring is more valuable, and a code index is even
better. Don't do yourself what a computer can do better.

Maarten
Re: Comments on Coding Style [message #70763 is a reply to message #70675] Thu, 29 April 2010 16:30 Go to previous message
Aram Panasenco is currently offline  Aram Panasenco
Messages: 41
Registered: April 2010
Member
I have just finished reformatting my code by IDLdoc standards
(http://pastebin.com/97ThuDCj). Not only does it provide for a great
header standard, it also makes pretty, pretty documentations. I can't
thank Mike Galloy enough for this.

~Aram Panasenco
Re: Comments on Coding Style [message #70767 is a reply to message #70668] Thu, 29 April 2010 14:17 Go to previous message
Michael Galloy is currently offline  Michael Galloy
Messages: 1114
Registered: April 2006
Senior Member
On 4/29/10 2:59 PM, David Fanning wrote:
> Mike Galloy writes:
>
>>>> Also, using one of the standard formats allows the Workbench to show
>>>> the help for the routine.
>>>
>>> How is this done?
>>
>> Nothing needs to be done to turn it on, just write the comments in
>> IDLdoc's rst format.
>
> But how is this accessed from the Workbench?

Ah, just mouse over a call to a routine in the editor. I see something like:

http://michaelgalloy.com/wp-content/uploads/2010/04/vis_conv ert_mouseover.png

VIS_CONVERT has a header like:

;+
; Use ImageMagick to convert a file between formats.
;
; :Params:
; basename : in, optional, type=string
; basename of file to convert (used for output name as well)
;
; :Keywords:
; density : in, optional, type=long, default=300
; density of output image in dots per inch
; scale : in, optional, type=long, default=100
; scale percentage to use
; from_extension : in, optional, type=string
; extension to use for input file
; from_eps : in, optional, type=boolean
; if set, indicates the input is a Encapsulated PostScript file
; from_png : in, optional, type=boolean
; if set, indicates the input is a PNG file
; from_ps : in, optional, type=boolean
; if set, indicates the input is a PostScript file
; max_dimensions : in, optional, type=lonarr(2)
; maximum dimensions for the output image in pixels
; to_extension : in, optional, type=string
; extension to use for output file
; to_eps : in, optional, type=boolean
; if set, indicates the output should a Encapsulated Postscript file
; to_png : in, optional, type=boolean
; if set, indicates the output should a PNG image file
; to_ps : in, optional, type=boolean
; if set, indicates the output should a Postscript file
; command : out, optional, type=string
; convert command
; output : out, optional, type=bytarr
; output image if output format is an image type
; convert_location : in, optional, type=string
; location of the convert command
;-
pro vis_convert, basename, $
density=density, $
max_dimensions=maxDimensions, $
scale=scale, $
from_extension=fromExtension, $
from_eps=fromEps, $
from_png=fromPng, $
from_ps=fromPs, $
to_extension=toExtension, $
to_eps=toEps, $
to_png=toPng, $
to_ps=toPs, $
command=cmd, $
output=output, $
convert_location=convertLocation

Mike
--
www.michaelgalloy.com
Research Mathematician
Tech-X Corporation
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: AO, SAO
Next Topic: Writing *.csv files

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

Current Time: Wed Oct 08 15:21:59 PDT 2025

Total time taken to generate the page: 0.00496 seconds