directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Emmanuel Lecharny <elecha...@apache.org>
Subject Re: [Coding Conventions] FYI: Why I use ii, jj, kk instead of i, j, k
Date Wed, 02 Nov 2005 01:53:56 GMT
On Tue, 2005-11-01 at 13:51 -0500, Alex Karasulu wrote:
> Just a heads up. I see others using i,j,k for loop variables.  This is 
> commonly the convention and I don't expect others to do what I do 
> especially with something as relatively insignificant as this.  However 
> I thought I'd let you know why I do this and who I learned it from.
> 
> Robb Penoyer was using this a while back (10 years ago in C) when I 
> asked why he does not just use i,j,k and instead uses ii,jj,kk instead.  
> I was just curious.  He said that he can search and find these variables 
> more easily in loops and he was right.  I found this helpful several 
> times so I adopted the convention.  

Actually, using loops with integer in java is something that does not
occurs very often. Iterator and Enumeration are pretty much confortable.

> It does not hurt readability and 
> allows me to search for loop variables easily since not every word 
> contains ii, jj, or kk.  

Well, considering that a loop should not contains more than a few lines,
readibility should not be an issue. If a loop using i, j or k is 50
lines long, we can question ourself : is the 50 lines necessary, or
should I call a method, and why not using a better name that i, j or k,
like iter, counter, or whatever ?

ii, jj, or kk is a trick that is almost useless on auto-completion IDE

> If everyone likes it we can use this as a 
> convention.  We need to start solidifying a coding convention for the 
> entire TLP.

Yeah, that's very true ! We also should use a common tool to format the
code accordingly to some common rules.

> 
> I think much more important than this loop variable example is to get 
> everyone to use 4 spaces for tabs instead of tabs which messes up SVN.  
> That should be law IMO.  Many people have adjusted their editors to fix 
> this issue in Java but I still see this problem all over in XML and 
> properties files.

+1000 (even if I may be one of the malevolent persons who use tabs
instead of spaces in XML files ;)

> 
> Alex
> 
> ---------------------------------------------------------------------------------------
> Wanadoo vous informe que cet  e-mail a ete controle par l'anti-virus mail. 
> Aucun virus connu a ce jour par nos services n'a ete detecte.
> 
> 
> 


Mime
View raw message