You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by sebb <se...@gmail.com> on 2012/03/14 14:33:55 UTC

[ALL] Is that 1 or l or I ?

I noticed that some of the CSV methods uses "int l" (ell).
This is unfortunately very similar to 1 (one) in many fonts.

ExtendedBufferedReader.read(...) and UnicodeUnescapeReader.read(...)
both do this.

Now that would perhaps be a good candidate for a CheckStyle report ?!

P.S. the subject has 1 (one) then l (ell) then I (upper-case i) in
case you cannot tell.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [ALL] Is that 1 or l or I ?

Posted by Adrian Crum <ad...@sandglass-software.com>.
Except in nested loops: Which integer is being incremented, the inner 
loop or outer loop? If the outer loop used outer instead of i, and the 
inner loop used inner instead of j, then the loop being incremented is 
obvious.

Idioms make sense as long as they're *your* idioms. To others it's 
confusing.

-Adrian

On 3/14/2012 5:11 PM, sebb wrote:
> On 14 March 2012 16:39, Adrian Crum<ad...@sandglass-software.com>  wrote:
>> Personally, I despise single character parameters/variable names. Seriously,
>> is it that much work to type a few extra characters and make the name
>> meaningful?
> Sometimes single char names are clearer.
> E.g. in for loops, using i and j is such a common idiom that renaming
> won't necessarily improve readability.
>
>> -Adrian
>>
>>
>> On 3/14/2012 1:33 PM, sebb wrote:
>>> I noticed that some of the CSV methods uses "int l" (ell).
>>> This is unfortunately very similar to 1 (one) in many fonts.
>>>
>>> ExtendedBufferedReader.read(...) and UnicodeUnescapeReader.read(...)
>>> both do this.
>>>
>>> Now that would perhaps be a good candidate for a CheckStyle report ?!
>>>
>>> P.S. the subject has 1 (one) then l (ell) then I (upper-case i) in
>>> case you cannot tell.
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>>> For additional commands, e-mail: dev-help@commons.apache.org
>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>> For additional commands, e-mail: dev-help@commons.apache.org
>>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [ALL] Is that 1 or l or I ?

Posted by Ralph Goers <ra...@dslextreme.com>.
On Mar 14, 2012, at 10:14 AM, Emmanuel Bourg wrote:

> Le 14/03/2012 18:11, sebb a écrit :
> 
>> Sometimes single char names are clearer.
>> E.g. in for loops, using i and j is such a common idiom that renaming
>> won't necessarily improve readability.
> 
> Same thing for x and y as coordinates.

I doubt anyone would make a mistake seeing x and y.  

But 

int I = 1;
int l = 2;

int amt = I + 1;

would make me very upset.

however, that isn't the same as 

for (int i=0; i <  100; ++i) {
	….
}

Ralph


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [ALL] Is that 1 or l or I ?

Posted by Emmanuel Bourg <eb...@apache.org>.
Le 14/03/2012 18:11, sebb a écrit :

> Sometimes single char names are clearer.
> E.g. in for loops, using i and j is such a common idiom that renaming
> won't necessarily improve readability.

Same thing for x and y as coordinates.

Emmanuel Bourg


Re: [ALL] Is that 1 or l or I ?

Posted by sebb <se...@gmail.com>.
On 14 March 2012 16:39, Adrian Crum <ad...@sandglass-software.com> wrote:
> Personally, I despise single character parameters/variable names. Seriously,
> is it that much work to type a few extra characters and make the name
> meaningful?

Sometimes single char names are clearer.
E.g. in for loops, using i and j is such a common idiom that renaming
won't necessarily improve readability.

> -Adrian
>
>
> On 3/14/2012 1:33 PM, sebb wrote:
>>
>> I noticed that some of the CSV methods uses "int l" (ell).
>> This is unfortunately very similar to 1 (one) in many fonts.
>>
>> ExtendedBufferedReader.read(...) and UnicodeUnescapeReader.read(...)
>> both do this.
>>
>> Now that would perhaps be a good candidate for a CheckStyle report ?!
>>
>> P.S. the subject has 1 (one) then l (ell) then I (upper-case i) in
>> case you cannot tell.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>> For additional commands, e-mail: dev-help@commons.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [ALL] Is that 1 or l or I ?

Posted by Adrian Crum <ad...@sandglass-software.com>.
Personally, I despise single character parameters/variable names. 
Seriously, is it that much work to type a few extra characters and make 
the name meaningful?

-Adrian

On 3/14/2012 1:33 PM, sebb wrote:
> I noticed that some of the CSV methods uses "int l" (ell).
> This is unfortunately very similar to 1 (one) in many fonts.
>
> ExtendedBufferedReader.read(...) and UnicodeUnescapeReader.read(...)
> both do this.
>
> Now that would perhaps be a good candidate for a CheckStyle report ?!
>
> P.S. the subject has 1 (one) then l (ell) then I (upper-case i) in
> case you cannot tell.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [ALL] Is that 1 or l or I ?

Posted by Gary Gregory <ga...@gmail.com>.
On Wed, Mar 14, 2012 at 10:27 AM, sebb <se...@gmail.com> wrote:

> On 14 March 2012 14:00, Gary Gregory <ga...@gmail.com> wrote:
> > On Wed, Mar 14, 2012 at 9:33 AM, sebb <se...@gmail.com> wrote:
> >
> >> I noticed that some of the CSV methods uses "int l" (ell).
> >> This is unfortunately very similar to 1 (one) in many fonts.
> >>
> >> ExtendedBufferedReader.read(...) and UnicodeUnescapeReader.read(...)
> >> both do this.
> >>
> >> Now that would perhaps be a good candidate for a CheckStyle report ?!
> >>
> >
> > You cannot compile a variable name that starts with a number, so that's
> not
> > an issue (unless you do not know this.)
> >
> > IMO, the rule should be that you should not start a local var or param
> name
> > with a upper case letter.
> >
> > Unfortunately, highlighting upper-i vs lower-L might be interesting for
> one
> > letter names but the problem still exists for normal names. Did I write
> > "normal" with a lower-L or an upper-i? This might get siLLy quick!
>
> I see I did not provide enough context.
> The problem is not the variable declaration, but the variable usage.
>
> If one cannot easily distinguish l (ell) and 1 (one) then it makes it
> very hard to follow the code, and easy for mistakes to creep in.
> In the Eclipse editor (which uses Courier by default) the two have
> identical glyphs (?) as far as I can tell.
>

Right, that makes sense. I don't use Courier in Eclipse. Even in
non-Courier upper-i and lower-L is a problem.

A checkstyle would help then.

Gary


>
> > Gary
> >
> > Gary
> >
> >>
> >> P.S. the subject has 1 (one) then l (ell) then I (upper-case i) in
> >> case you cannot tell.
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> >> For additional commands, e-mail: dev-help@commons.apache.org
> >>
> >>
> >
> >
> > --
> > E-Mail: garydgregory@gmail.com | ggregory@apache.org
> > JUnit in Action, 2nd Ed: <http://goog_1249600977>http://bit.ly/ECvg0
> > Spring Batch in Action: <http://s.apache.org/HOq>http://bit.ly/bqpbCK
> > Blog: http://garygregory.wordpress.com
> > Home: http://garygregory.com/
> > Tweet! http://twitter.com/GaryGregory
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
>


-- 
E-Mail: garydgregory@gmail.com | ggregory@apache.org
JUnit in Action, 2nd Ed: <http://goog_1249600977>http://bit.ly/ECvg0
Spring Batch in Action: <http://s.apache.org/HOq>http://bit.ly/bqpbCK
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory

Re: [ALL] Is that 1 or l or I ?

Posted by sebb <se...@gmail.com>.
On 14 March 2012 14:00, Gary Gregory <ga...@gmail.com> wrote:
> On Wed, Mar 14, 2012 at 9:33 AM, sebb <se...@gmail.com> wrote:
>
>> I noticed that some of the CSV methods uses "int l" (ell).
>> This is unfortunately very similar to 1 (one) in many fonts.
>>
>> ExtendedBufferedReader.read(...) and UnicodeUnescapeReader.read(...)
>> both do this.
>>
>> Now that would perhaps be a good candidate for a CheckStyle report ?!
>>
>
> You cannot compile a variable name that starts with a number, so that's not
> an issue (unless you do not know this.)
>
> IMO, the rule should be that you should not start a local var or param name
> with a upper case letter.
>
> Unfortunately, highlighting upper-i vs lower-L might be interesting for one
> letter names but the problem still exists for normal names. Did I write
> "normal" with a lower-L or an upper-i? This might get siLLy quick!

I see I did not provide enough context.
The problem is not the variable declaration, but the variable usage.

If one cannot easily distinguish l (ell) and 1 (one) then it makes it
very hard to follow the code, and easy for mistakes to creep in.
In the Eclipse editor (which uses Courier by default) the two have
identical glyphs (?) as far as I can tell.

> Gary
>
> Gary
>
>>
>> P.S. the subject has 1 (one) then l (ell) then I (upper-case i) in
>> case you cannot tell.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>> For additional commands, e-mail: dev-help@commons.apache.org
>>
>>
>
>
> --
> E-Mail: garydgregory@gmail.com | ggregory@apache.org
> JUnit in Action, 2nd Ed: <http://goog_1249600977>http://bit.ly/ECvg0
> Spring Batch in Action: <http://s.apache.org/HOq>http://bit.ly/bqpbCK
> Blog: http://garygregory.wordpress.com
> Home: http://garygregory.com/
> Tweet! http://twitter.com/GaryGregory

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [ALL] Is that 1 or l or I ?

Posted by Gary Gregory <ga...@gmail.com>.
On Wed, Mar 14, 2012 at 9:33 AM, sebb <se...@gmail.com> wrote:

> I noticed that some of the CSV methods uses "int l" (ell).
> This is unfortunately very similar to 1 (one) in many fonts.
>
> ExtendedBufferedReader.read(...) and UnicodeUnescapeReader.read(...)
> both do this.
>
> Now that would perhaps be a good candidate for a CheckStyle report ?!
>

You cannot compile a variable name that starts with a number, so that's not
an issue (unless you do not know this.)

IMO, the rule should be that you should not start a local var or param name
with a upper case letter.

Unfortunately, highlighting upper-i vs lower-L might be interesting for one
letter names but the problem still exists for normal names. Did I write
"normal" with a lower-L or an upper-i? This might get siLLy quick!

Gary

Gary

>
> P.S. the subject has 1 (one) then l (ell) then I (upper-case i) in
> case you cannot tell.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
>


-- 
E-Mail: garydgregory@gmail.com | ggregory@apache.org
JUnit in Action, 2nd Ed: <http://goog_1249600977>http://bit.ly/ECvg0
Spring Batch in Action: <http://s.apache.org/HOq>http://bit.ly/bqpbCK
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory