I'm not saying well-named variables aren't important, I'm saying it's actually impossible sometimes to write code that is understandable, works, and has no comments, like pancakepalace's first example.kikito wrote:I agree that finding the right name for variables is hard. But it doesn't take hours. It often takes seconds - and most difficult cases take minutes. Not only that, but a good design, and good names, do save hours in the long run. If it's taking you so long to find names, that can be solved with practice.slime wrote:People write code to accomplish things, not for the sake of writing code. Instead of wasting your time pondering how to write clear, concise code with perfectly named variables (which is often impossible) for hours at a time, you can just put a comment there. That's one of the main purposes of comments.
Comments can also be really good for explaining the overarching goal of something, rather than what's happening right then and there, even when things have properly named variables.
Trying to make understandable variables 100% of the time can also lead to extreme verbosity, which makes me want to stab my eyes out. In my opinion, extreme verbosity (thisIsTheThingThatDoesBlahAndFooBecauseMyBossSaidSoAlsoItsAVector = vector(), for example) is much worse than extreme simplicity (v = vector()).