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

Home » Public Forums » archive » 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
Comments on Coding Style [message #70698] Wed, 28 April 2010 23:26 Go to next message
Aram Panasenco is currently offline  Aram Panasenco
Messages: 41
Registered: April 2010
Member
Hey again people,

I have recently switched to a different coding style. I am currently in
the first steps of writing a relatively big (for me at least) solar
software project. I want to keep the source code readable and modifiable
for other programmers, and I also want to use a consistent convention
that other people would want to uphold. I have written a small part of a
standard class that my program will use in a convention that I plan to
keep for all classes.

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.

Here's the class itself (finally :P)
http://pastebin.com/DXZUsL30

Thank you for your criticism,
~Aram Panasenco
Re: Comments on Coding Style [message #70750 is a reply to message #70698] Fri, 30 April 2010 06:07 Go to previous message
David Gell is currently offline  David Gell
Messages: 29
Registered: January 2009
Junior Member
On Apr 29, 1:26 am, Aram Panasenco <panasencoa...@gmail.com> wrote:
> Hey again people,
>
> I have recently switched to a different coding style. I am currently in
> the first steps of writing a relatively big (for me at least) solar
> software project. I want to keep the source code readable and modifiable
> for other programmers, and I also want to use a consistent convention
> that other people would want to uphold. I have written a small part of a
> standard class that my program will use in a convention that I plan to
> keep for all classes.
>
> 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.
>
> Here's the class itself (finally :P)http://pastebin.com/DXZUsL30
>
> Thank you for your criticism,
>   ~Aram Panasenco

I've found using a "Hungarian Notation" where variable names are
prefixed with an code indicating their intended type is useful. IDL is
a flexibly typed language where the type of variable can be
inadvertently changed, so encoding the intended type of the variable
in its name is helpful for debugging. We use the following

type prefix example
string s sName
number n nBigNumber
Boolean b bFlag5
structs x xStructs
widget event we weEvent
widget identifier wi wiOption
widget user data wu wuWState
array a-- axStructs
pointer p-- pPointer1

I don't distinguish between different numerical types. Variable name
capitalization is "camel case" with words capitalized. Variable names
should be descriptive.

As far as comments go, there is no such thing as self-documenting
code. Anyone can figure out what a statement does, but not why. Make
sure you document intent. Remember that you've two audiences when you
write code, the computer, and the poor sod who has to maintain the
code maybe years later. Write code like you write an essay, in
paragraphs. Each paragraph has an intent, document it, then follow
with the code that performs that action.
Re: Comments on Coding Style [message #70757 is a reply to message #70698] Thu, 29 April 2010 19:35 Go to previous message
penteado is currently offline  penteado
Messages: 866
Registered: February 2018
Senior Member
Administrator
On Apr 29, 6:30 pm, David Fanning <n...@dfanning.com> wrote:
> mgalloy writes:
>> Ah, just mouse over a call to a routine in the editor.
>
> Ah, ha! I guess I had trained my mouse NOT to roll over
> calls to the routines, because I find this pop-up thing
> obscuring the very code I want to look at. Thus, I had
> completely forgotten this functionality was there. Funny! :-)

The editor also recognizes comments in the old (IDL) format. But with
the rst format it shows more information (all tags?).
Re: Comments on Coding Style [message #70766 is a reply to message #70698] Thu, 29 April 2010 14:30 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
mgalloy writes:

> Ah, just mouse over a call to a routine in the editor.

Ah, ha! I guess I had trained my mouse NOT to roll over
calls to the routines, because I find this pop-up thing
obscuring the very code I want to look at. Thus, I had
completely forgotten this functionality was there. Funny! :-)

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.")
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: SSW Coordinate Conversions
Next Topic: How to read field attributes in HDF-EOS

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

Current Time: Fri Oct 10 08:13:46 PDT 2025

Total time taken to generate the page: 2.00014 seconds