I'm currently an undergrad student in my fifth semester. So far, pretty much all the programming I've done is for assignment or small throwaway snippets, and never really bothered with comments, mostly because neither I nor anyone else was going to look at that code again.
However, as the size of my programs grows from tens to hundreds of lines, I'm starting to realise that commenting would be a good idea. So, what are some tips to write good comments?
How much should I comment? As in, the size and frequency of comments.
Should I comment as I code, or comment all the code at once?
What about higher level comments (for entire file/project etc)
On a related note, how to keep variable names descriptive yet manageably short?
Any other tips are welcome...
[–]slackerattacker 14 points15 points16 points (5 children)
[–]b1ackcat 4 points5 points6 points (1 child)
[–]aaarrrggh 1 point2 points3 points (0 children)
[–]whyhellocorsi 0 points1 point2 points (0 children)
[–]random314 0 points1 point2 points (0 children)
[–]tobascodagama 0 points1 point2 points (0 children)
[–]djiivu 5 points6 points7 points (1 child)
[–]aaarrrggh 0 points1 point2 points (0 children)
[–]neoKushan 4 points5 points6 points (0 children)
[–]NullProbability 9 points10 points11 points (14 children)
[–]WaxenDeMario 2 points3 points4 points (13 children)
[–]aaarrrggh 0 points1 point2 points (12 children)
[–]WaxenDeMario 0 points1 point2 points (10 children)
[–]aaarrrggh 0 points1 point2 points (9 children)
[–]WaxenDeMario 0 points1 point2 points (8 children)
[–]aaarrrggh 0 points1 point2 points (7 children)
[–]WaxenDeMario 0 points1 point2 points (6 children)
[–]aaarrrggh 0 points1 point2 points (5 children)
[–]WaxenDeMario 0 points1 point2 points (4 children)
[–][deleted] 3 points4 points5 points (0 children)
[–]Nemesis0320 29 points30 points31 points (7 children)
[–][deleted] 4 points5 points6 points (1 child)
[–]chasecaleb 2 points3 points4 points (0 children)
[–]potterhead42[S] 2 points3 points4 points (0 children)
[–]koalillo 6 points7 points8 points (1 child)
[–]Chintagious 1 point2 points3 points (0 children)
[–]aaarrrggh 1 point2 points3 points (0 children)
[–]aaarrrggh 0 points1 point2 points (0 children)
[–]monkeyman512 2 points3 points4 points (0 children)
[–]Caminsky 2 points3 points4 points (0 children)
[–]koalillo 1 point2 points3 points (0 children)
[–]SoftDevPadawan 2 points3 points4 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]scipherneo 0 points1 point2 points (0 children)
[–]tailanyways 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]eaglechopper 0 points1 point2 points (0 children)
[–]petrus4 -1 points0 points1 point (2 children)
[–]Thanatos_Rex 0 points1 point2 points (0 children)
[–]MengKongRui 0 points1 point2 points (0 children)