News for hackers. Stuff that matters.
Re:Cognitive Biases in Programming by kruczek on Monday October 16, 2017 @07:31AM (#15482456)
Well, it's a good gut reaction to have. As you wrote yourself "In reality, both are equally easy to write" - therefore the first one is a good default to assume, because in some cases it may actually matter.

If you choose good default, then you won't spend any more time thinking about it; if you have bad defaults, then you will have to figure out where the slowdown comes from and eliminate it.

Re:Cognitive Biases in Programming by mikeash on Monday October 16, 2017 @08:50AM (#15482811)
It's a bad gut reaction to have for a newer programmer who is struggling to find any solution to the problem at hand.
Re:Cognitive Biases in Programming by kruczek on Tuesday October 17, 2017 @06:33AM (#15489883)
So, if I understand your point correctly, you mean that newer programmers, who are struggling to find any solution at all, would go for the (subjectively) easier one, i.e. the one with f1() outside of the loop?

I agree they would go for the easier one, but I don't understand why they would perceive the first version to be easier. And even if they would, why is it bad?