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

Home » Public Forums » archive » Re: Code Metrics tools for 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: Code Metrics tools for IDL [message #36224] Thu, 28 August 2003 10:05
Liam E. Gumley is currently offline  Liam E. Gumley
Messages: 378
Registered: January 2000
Senior Member
"John" <jgreive@starband.net> wrote in message
news:c53c914e.0308280754.25f84ccb@posting.google.com...
> Hello,
> Does anyone know of any tools to calculate quality metrics for IDL
> code. For example, does anyone have a tool that would calculate
> cyclomatic complexity metrics?

See "Code Complete" by Steve McConnell, pp 394-396. To paraphrase:

The McCabe complexity for a routine may be estimated as follows:

(1) Start with 1 for the straight path through the routine

(2) Add 1 for each of the following control statements: IF, WHILE, REPEAT,
FOR, AND, OR

(3) Add 1 for each case in a CASE statement

Guidelines: if the complexity is
0-5 The routine is probably fine
6-10 Think about ways to simplify the routine
10+ Break part(s) of the routine into smaller routines which can be
called from within the parent routine

No doubt you could write a shell script to parse an IDL source file and
compute the total complexity.

Cheers,
Liam.
Practical IDL Programming
http://www.gumley.com/
Re: Code Metrics tools for IDL [message #36232 is a reply to message #36224] Thu, 28 August 2003 09:27 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
James Kuyper writes:

> I'm a little confused by that joke. What does dynamic typing have to do
> with the number of control paths in a program?

Oh, oh. I guess I should have googled for "cyclomatic
complexity metrics" before I made a fool of myself.
Obviously they aren't what I *thought* they were. :^)

Cheers,

David

--
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
Re: Code Metrics tools for IDL [message #36233 is a reply to message #36232] Thu, 28 August 2003 09:18 Go to previous message
James Kuyper is currently offline  James Kuyper
Messages: 425
Registered: March 2000
Senior Member
David Fanning wrote:
>
> John writes:
>
>> Does anyone know of any tools to calculate quality metrics for IDL
>> code. For example, does anyone have a tool that would calculate
>> cyclomatic complexity metrics?
>
> I think because IDL is a dynamically typed language
> that the cyclomatic complexity metrics always
> approach infinity. This is especially true if you
> have tried to incorporate any of JD's tricks into
> your code. :-)

I'm a little confused by that joke. What does dynamic typing have to do
with the number of control paths in a program?
Re: Code Metrics tools for IDL [message #36234 is a reply to message #36233] Thu, 28 August 2003 09:12 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
John writes:

> Does anyone know of any tools to calculate quality metrics for IDL
> code. For example, does anyone have a tool that would calculate
> cyclomatic complexity metrics?

I think because IDL is a dynamically typed language
that the cyclomatic complexity metrics always
approach infinity. This is especially true if you
have tried to incorporate any of JD's tricks into
your code. :-)

Cheers,

David

--
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
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: how to make polygons created by idlgrpolygon transparent?
Next Topic: Re: how to make polygons created by idlgrpolygon transparent?

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

Current Time: Thu Oct 09 20:40:35 PDT 2025

Total time taken to generate the page: 2.39918 seconds