News for hackers. Stuff that matters.
Re:Cognitive Biases in Software Development by onion2k on Tuesday March 31, 2020 @04:43AM (#22735868)
'a' and 'i' are perfect for indexes

Except they're not as good as 'index', which is obvious and provides some meaning, so why accept single character name?

I have an eslint rule that blocks single character var names on my projects. It makes my team develop good habits, and no one has ever complained about it. Our code is very readable.

Re:Cognitive Biases in Software Development by raverbashing on Tuesday March 31, 2020 @04:52AM (#22735909)
> so why accept single character name?

Because readability suffers with repeated long variable names

There's a reason why math uses i,j,k and x,y,z and it's not to be petty.

Re:Cognitive Biases in Software Development by onion2k on Tuesday March 31, 2020 @06:42AM (#22736382)
There's also a reason why a lot of people find equations incredibly hard to parse.
Re:Cognitive Biases in Software Development by Nevermark on Wednesday April 01, 2020 @12:15AM (#22745613)
This is a nice semi-random deeply nested spot to observe how the topic of naming is so cognitively attractive.

Even in the meta-sense it is being discussed here.

There is something about naming that we like thinking about, and fine tune our thoughts on, more than a simple need for legibility.

There is a sense of ownership in picking a name.

Re:Cognitive Biases in Software Development by de_watcher on Tuesday March 31, 2020 @09:02AM (#22737057)
Are you awful or just trolling? I've said that naming is very important, but I didnt't suggest that people should choose a longer word when two are equivalent. A real way to give 'more meaning' to the index is to indicate to which collection it belongs.