Random Thoughts

Thursday, April 17, 2008

Perl Tutorial: Don't name a variable i, y or j

I worked with a guy named Dean back in 89-91 at Dupont that taught me a really simple trick. Most people use the variable names i, y or j for simple counters ( damn Fortran). I don't know about emacs, but in vi, a search for 'i' is painful. But searching for "ii" is much less painful.

My counters are now always 2 letters for this reason.

So if you are going to use simple non-descriptive pointer variables, use something you can reasonably search.

Labels: , ,

0 Comments:

Post a Comment

Links to this post:

Create a Link

<< Home


-->