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

Home » Public Forums » archive » Re: Is there any conventions style programming IDL?
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: Is there any conventions style programming IDL? [message #39074] Sun, 25 April 2004 00:32 Go to next message
Paul Sorenson is currently offline  Paul Sorenson
Messages: 48
Registered: May 2002
Member
"Dick Jackson" <dick@d-jackson.com> wrote in message
news:KNcic.223564$Pk3.78786@pd7tw1no...
>
> I agree with Mike Wallace in general, but I find it useful to identify
> two kinds of identifiers in special ways: objects and pointers. I do
> this since we work with them in ways quite different from the other
> types. For example, when I see variable pInfo, the 'p' reminds me that I
> need to dereference with '*' before using the thing itself.
>

Yeah. What he said. Objects and pointers.

-Paul Sorenson
www.paulsorenson.com
Re: Is there any conventions style programming IDL? [message #39086 is a reply to message #39074] Fri, 23 April 2004 11:39 Go to previous messageGo to next message
Michael Wallace is currently offline  Michael Wallace
Messages: 409
Registered: December 2003
Senior Member
> For those who are wondering (like I was) "Hungarian Notation" refers to
> what Mike Schienle suggests, as in:
>
> Variables of type Byte shall begin with the letter "b"
>
> A full description of this and other aspects of naming identifiers is
> this article at Microsoft's MSDN site:
>
> http://tinyurl.com/ezmr

Thanks for the link. I tend to forget that folks in this newsgroup
aren't always programmers like myself and may not know some of these
computer science ideas I throw out. For anyone too lazy to click the
above link, Hungarian notation refers to prefixing a variable name with
some sort descriptor that indicates the variable's type. For the
curious, it's called Hungarian notation because the creator of system
was a Hungarian.

-Mike
Re: Is there any conventions style programming IDL? [message #39088 is a reply to message #39086] Fri, 23 April 2004 10:56 Go to previous messageGo to next message
Dick Jackson is currently offline  Dick Jackson
Messages: 347
Registered: August 1998
Senior Member
"Michael Wallace" <mwallace_spam@spam.swri.edu.invalid> wrote in message
news:108h4fvomj43c49@corp.supernews.com...
>
> Dick Jackson wrote:
>
>> Mike Schienle has this available on the web:
>> http://www.customvisuals.com/IDL_Style.html
>
> This document combined with a couple of tips from David make a good
set
> of rules to follow. There are a couple things I think I'll adopt into
> my personal style. However, I have to disagree with the use of
> Hungarian notation. IDL is a weakly-typed, dynamic language and
> enforcing Hungarian rules removes some of the benefits of such a
> language. I don't have the time now to get into the details, but I
see
> it as more of a hindrance rather than a help.
>
> Hungarian notation is not suited to weakly-typed dynamic languages
such
> as IDL, Python or Perl or object-oriented languages such as Java or
C++.
> Hungarian notation does have it's place in the strongly-typed
> procedural languages like good ol' C. I actually use Hungarian
notation
> a lot when doing C -- it makes casting and variable type mistakes so
> much easier to catch.
>
> -Mike

For those who are wondering (like I was) "Hungarian Notation" refers to
what Mike Schienle suggests, as in:

Variables of type Byte shall begin with the letter "b"

A full description of this and other aspects of naming identifiers is
this article at Microsoft's MSDN site:

http://tinyurl.com/ezmr

I agree with Mike Wallace in general, but I find it useful to identify
two kinds of identifiers in special ways: objects and pointers. I do
this since we work with them in ways quite different from the other
types. For example, when I see variable pInfo, the 'p' reminds me that I
need to dereference with '*' before using the thing itself.

Just my CAD 0.02 (two Canadian cents' worth)

Cheers,
--
-Dick

Dick Jackson / dick@d-jackson.com
D-Jackson Software Consulting / http://www.d-jackson.com
Calgary, Alberta, Canada / +1-403-242-7398 / Fax: 241-7392
Re: Is there any conventions style programming IDL? [message #39093 is a reply to message #39088] Fri, 23 April 2004 01:52 Go to previous messageGo to next message
Esteban Garc�a Cues is currently offline  Esteban Garc�a Cues
Messages: 7
Registered: April 2004
Junior Member
No I don't have problems whit criticism , I only hope you won't have
problems whit spanish ;-)
(You have to understand me because I'm writting the document in my
language and I dont fell to translate it, at least not now, not time).
Cheers,
Esteban Garc�a Cuesta

"David Fanning" <david@dfanning.com> escribi� en el mensaje
news:MPG.1af1d0713e280b95989729@news.frii.com...
> Esteban Garc�a Cuesta writes:
>
>> Thanks, I'm going to write a document of conventions style programming
with
>> all your
>> ideas and the ''Code conventions for the Java Programming Language'' and
>> I'll put it here to
>> know your opinions about it.
>
> I don't like it!!
>
> Oh, wait, I haven't even seen it. :-(
>
> Uh, sure, put it here. I just hope you're not the type
> of person who gets flustered by a little criticism. :-)
>
> Cheers,
>
> David
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting
> Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: Is there any conventions style programming IDL? [message #39095 is a reply to message #39093] Thu, 22 April 2004 20:48 Go to previous messageGo to next message
Michael Wallace is currently offline  Michael Wallace
Messages: 409
Registered: December 2003
Senior Member
> Mike Schienle has this available on the web:
> http://www.customvisuals.com/IDL_Style.html

This document combined with a couple of tips from David make a good set
of rules to follow. There are a couple things I think I'll adopt into
my personal style. However, I have to disagree with the use of
Hungarian notation. IDL is a weakly-typed, dynamic language and
enforcing Hungarian rules removes some of the benefits of such a
language. I don't have the time now to get into the details, but I see
it as more of a hindrance rather than a help.

Hungarian notation is not suited to weakly-typed dynamic languages such
as IDL, Python or Perl or object-oriented languages such as Java or C++.
Hungarian notation does have it's place in the strongly-typed
procedural languages like good ol' C. I actually use Hungarian notation
a lot when doing C -- it makes casting and variable type mistakes so
much easier to catch.

-Mike
Re: Is there any conventions style programming IDL? [message #39099 is a reply to message #39095] Thu, 22 April 2004 13:49 Go to previous messageGo to next message
Dick Jackson is currently offline  Dick Jackson
Messages: 347
Registered: August 1998
Senior Member
"Esteban Garc�a Cuesta" <egc@fis.uc3m.es> wrote in message
news:c686up$a84$1@khitai.uc3m.es...
> Hello,
> I'm trying to standarize the way we programm in IDL , is there
any
> rules or conventions programming IDL ?

Mike Schienle has this available on the web:
http://www.customvisuals.com/IDL_Style.html

(for any of you who had links to it at www.ivsoftware.com, please note
the change of name!)

Cheers,
--
-Dick

Dick Jackson / dick@d-jackson.com
D-Jackson Software Consulting / http://www.d-jackson.com
Calgary, Alberta, Canada / +1-403-242-7398 / Fax: 241-7392
Re: Is there any conventions style programming IDL? [message #39100 is a reply to message #39099] Thu, 22 April 2004 12:52 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Esteban Garc�a Cuesta writes:

> Thanks, I'm going to write a document of conventions style programming with
> all your
> ideas and the ''Code conventions for the Java Programming Language'' and
> I'll put it here to
> know your opinions about it.

I don't like it!!

Oh, wait, I haven't even seen it. :-(

Uh, sure, put it here. I just hope you're not the type
of person who gets flustered by a little criticism. :-)

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: Is there any conventions style programming IDL? [message #39101 is a reply to message #39100] Thu, 22 April 2004 12:24 Go to previous messageGo to next message
Esteban Garc�a Cues is currently offline  Esteban Garc�a Cues
Messages: 7
Registered: April 2004
Junior Member
Thanks, I'm going to write a document of conventions style programming with
all your
ideas and the ''Code conventions for the Java Programming Language'' and
I'll put it here to
know your opinions about it.

Cheers.
Esteban Garc�a Cuesta

"Esteban Garc�a Cuesta" <egc@fis.uc3m.es> escribi� en el mensaje
news:c686up$a84$1@khitai.uc3m.es...
> Hello,
> I'm trying to standarize the way we programm in IDL , is there any
> rules or conventions programming IDL ?
>
> Thanks a lot.
> Esteban Garc�a Cuesta
>
>
>
>
Re: Is there any conventions style programming IDL? [message #39103 is a reply to message #39101] Thu, 22 April 2004 07:24 Go to previous messageGo to next message
meinel is currently offline  meinel
Messages: 14
Registered: February 1994
Junior Member
"Esteban Garc�a Cuesta" <egc@fis.uc3m.es> wrote in message news:<c686up$a84$1@khitai.uc3m.es>...
> Hello,
> I'm trying to standarize the way we programm in IDL , is there any
> rules or conventions programming IDL ?
>
> Thanks a lot.
> Esteban Garc�a Cuesta

Only personal preferences. If you use EMACS there is a plug-in that
will take care of most pretty-fying for you.

My personal preferences for ease of readability are:
Procedures/functions/keywords all UPPERCASE
Variables all lowercase
Indent FOR loops, CASE, IF, continuation lines
Keywords on separate continuation lines
Align multiple "=" or "$" or anything else common to multiple lines
A keyword and its associated variable should have the same name

For example, call a procedure with multiple keywords:
---------------------------------------------

PLOT, hist, $
XMARGIN = [0, 0], $
YMARGIN = [0, 0], $
XSTYLE = 1, $
PSYM = 10, $
YRANGE = [0, 0.9*MAX(hist)] , $
XRANGE = [0, N_ELEMENTS(hist) - 1]

---------------------------------------------
(I don't know how this will appear on GOOGLE, but if you use a
fixed-pitch font, these lines will appear the way I described)

Multiple IF...THEN lines:
---------------------------------------------

; Defaults for keywords

IF (N_ELEMENTS(title) EQ 0) THEN title = 'New Data'
IF (N_ELEMENTS(latitude) EQ 0) THEN latitude = [0, 0, 0, 0]
IF (N_ELEMENTS(longitude) EQ 0) THEN longitude = [0, 0, 0, 0]
IF (N_ELEMENTS(filename) EQ 0) THEN filename = ''
IF (N_ELEMENTS(true) EQ 0) THEN true = 3

---------------------------------------------
Of course, if you are devious and WANT to make your distribution code
hard to read, you can remove all extra white space (all UPPERCASE
strings need whitespace) and reassign the variables with random
strings (search for lowercase strings).

Have fun!

Ed Meinel
Re: Is there any conventions style programming IDL? [message #39104 is a reply to message #39103] Thu, 22 April 2004 06:32 Go to previous messageGo to next message
mmiller3 is currently offline  mmiller3
Messages: 81
Registered: January 2002
Member
>>>> > "Esteban" == Esteban Garc�a Cuesta <egc@fis.uc3m.es> writes:

> Hello, I'm trying to standarize the way we programm in
> IDL , is there any rules or conventions programming IDL ?

This idea makes life on the IDL front enormously simpler:
http://www.dfanning.com/tips/namefiles.html

Mike

--
Michael A. Miller mmiller3@iupui.edu
Imaging Sciences, Department of Radiology, IU School of Medicine
Re: Is there any conventions style programming IDL? [message #39105 is a reply to message #39104] Thu, 22 April 2004 06:47 Go to previous messageGo to next message
Antonio Santiago is currently offline  Antonio Santiago
Messages: 201
Registered: February 2004
Senior Member
Hola Esteban,

por lo general se suele escribir en mayusculas las palabras de IDL
(sentencias, funciones, etc.)

Hasta luego.
Antonio


Esteban Garc�a Cuesta wrote:
> Hello,
> I'm trying to standarize the way we programm in IDL , is there any
> rules or conventions programming IDL ?
>
> Thanks a lot.
> Esteban Garc�a Cuesta
>
>
>
>
Re: Is there any conventions style programming IDL? [message #39106 is a reply to message #39104] Thu, 22 April 2004 05:43 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Esteban Garc�a Cuesta writes:

> I'm trying to standarize the way we programm in IDL , is there any
> rules or conventions programming IDL ?

Of course there are rules. It's just that nobody follows
them. :-(

Here is a fairly interesting discussion for you:

http://tinyurl.com/yqvp6

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: Is there any conventions style programming IDL? [message #39209 is a reply to message #39088] Mon, 26 April 2004 13:32 Go to previous message
Dick Jackson is currently offline  Dick Jackson
Messages: 347
Registered: August 1998
Senior Member
"Dick Jackson" <dick@d-jackson.com> wrote in message
news:KNcic.223564$Pk3.78786@pd7tw1no...
>
> For those who are wondering (like I was) "Hungarian Notation" refers
to
> what Mike Schienle suggests, as in:
>
> Variables of type Byte shall begin with the letter "b"
>
> A full description of this and other aspects of naming identifiers is
> this article at Microsoft's MSDN site:
>
> http://tinyurl.com/ezmr
>
> I agree with Mike Wallace in general, but I find it useful to identify
> two kinds of identifiers in special ways: objects and pointers. I do
> this since we work with them in ways quite different from the other
> types. For example, when I see variable pInfo, the 'p' reminds me that
I
> need to dereference with '*' before using the thing itself.
>
> Just my CAD 0.02 (two Canadian cents' worth)

Mirko Vukovic asked me to forward this to the group:

-----

I find Hungarian very usefull in designating the ``role'' of variables.
That is one level higher than type. Consider the foolwing
multiple-usage of File and FileName. The hungarian notation allows (me)
a simple naming convention.

vFileName=['file.1','file.2','file.3'...]
cFile=n_elements(vFileName)
for iFile=0,cFile-1 do begin
FileName=vFileName[iFile]
...

In the above, c stands for count, i for index, v for vector. I even use
it in combinations, such as

viGoodPixel=where(mPixel eq ...,cGoodPixel)

Now, vi is a vector of pixels, and cGoodPixel is the count of good
pixels. And so it goes.

Dr.Ko

-----
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Check marks on context sensitive menus
Next Topic: WHERE Command Bug with Floating underflow

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

Current Time: Wed Oct 08 17:40:50 PDT 2025

Total time taken to generate the page: 0.00779 seconds