The message below was sent by one of the programmers of my favorite  
data analysis package in answer to a question about strings in IGORs  
internal scripting language.  The key point is made below the word  
"Simplify".  These guys maintain and debug in record time (typical  
turnaround on bug reports is < 24 hrs!  Bob's almost that fast too!)  
an extremely sophisticated graphics/data analysis package.  I think  
that his comment that more lines of code is sometimes better is worth  
considering seriously.  I've had trouble deciphering some sections of  
code in Jmol where we've tried to pack everything on to one line.   
I'm not sure that is the best approach for the long term.

Jonathan
> $ converts a string into a name. That's all.
>
> People get into trouble when they get all computer-wizardly and try  
> stuff like:
>
>       wave c=$("root:Calib:"+therm+"_R_Coef")
>       Wave coef=root:$folderlist[index]:$(therm+"_Pade44_Coef")
>
> If you have trouble understanding it today, what will you make of  
> it when
> you encounter it again in a year?
>
> Simplify:
>       String pathToWave= "root:Calib:"+therm+"_R_Coef"
>       wave c=$pathToWave
>
>       String pathToWave= "root:"+folderlist[index]+":"+therm+"_Pade44_Coef"
>       Wave coef=$pathToWave
>
> Yes, in many cases simpler is more code. Listen to the Sensei, and  
> you will
> know The Way :-). And you can debug the darn thing easier, too; you  
> can put
> a breakpoint after the path is created and see if it is sensible.  
> With the
> wizardly approach you know only that the wave reference stays NULL.
>
> If you need parentheses, then you have not achieved enlightenment.
>
> Seriously, I always rewrite anything that would require parentheses  
> using
> intermediate assignments like those above. They're just not worth the
> trouble.
>
> --Jim
> -- 
>
> Jim "How does it work?" Prouty
>
> Voice: (503) 620-3001, FAX: (503) 620-6754
> Makers of IGOR Pro, scientific data analysis and graphing for Mac  
> and PC



                          Dr. Jonathan H. Gutow
Chemistry Department                                 [email protected]
UW-Oshkosh                                           Office:920-424-1326
800 Algoma Boulevard                                 FAX:920-424-2042
Oshkosh, WI 54901
                  http://www.uwosh.edu/faculty_staff/gutow/





------------------------------------------------------------------------------
_______________________________________________
Jmol-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-developers

Reply via email to