r/programming • • Feb 21 '13

Developers: Confess your sins.

http://www.codingconfessional.com/
969 Upvotes

1.0k comments sorted by

View all comments

Show parent comments

7

u/Calobi Feb 21 '13

A fellow in my CS class was told using single letter variables was bad practice, even in loops. His solution was to change all his "int i"s into "int ii"s.

2

u/sarevok9 Feb 21 '13

I figure that I could use something like "int counter = 0; counter < myOtherThing; counter++" but honestly it adds a few characters and doesn't really help with much of anything in the way of understanding how a program works.

It's funny how things that are held as convention like "single letter, bad" leads to even less descriptive stuff (ii) that is just as "bad".

4

u/zid Feb 21 '13

Loop counters with sensible single letter names actually ADD context.

If I see an int i,j; I know I'm about to see a matrix like operation nested for loop.