Hacker News new | past | comments | ask | show | jobs | submit login

What's really annoying is that most of the time you see this kind of comment there is no explanation why 10 was chosen.



And that's what comments really need to do: tell 'why.'



That's why you should use constants. Still self documenting without the need for comments (usually).


    const TEN = 12;


    #define true false


In our embedded systems class we were required to define all of our constants, just to add another level of description to operations. It definitely helped to navigate spaghetti code.




Join us for AI Startup School this June 16-17 in San Francisco!

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

Search: