Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I don't disagree with your points at all. Short life variables I do tend to declare later in the code.

But most of the major state variables (especially the ones that get returned, or important data structures I want to keep track of in the code flow) I stick at the top with comments and explanations of what the variable is and why it exists.



That's better to hear. I'd still invite you to try and make a conscious efforts to make your functions smaller and more numerous. That might help you reduce the number of variables you need to make an effort to actually keep track of. :)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: