News for hackers. Stuff that matters.
Re:Greppability is an underrated code metric by VonGallifrey on Tuesday September 03, 2024 @05:02AM (#41432831)
The way I have seen this is that single letter variables are mostly used when declaration and (all) usages are very close together.

If I see a loop with i or k, v then I can be fairly confident that those are an Index or a Key Value pair. Also I probably don't need to grep them since everything interacting with these variables is probably already on my screen.

Everything that has a wider scope or which would be unclear with a single letter is named with a more descriptive name.

Of course this is highly dependent on the people you work with, but this is the way it works on projects I have worked on.

There are no comments on this comment yet.