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

Not sure about you, but I learned to code by writing psuedo code.

I routinely start with comments that psuedo code my idea and then add the sections of the code.

If I can't remember how everything is supposed to work while I'm writing it, what hope does the intern 2 years from now have in adding a new feature?



Yeah, sometimes if I'm doing a complex logic block I will just put the conditionals in and fill them in with a short description of what will be there. Generally, since I've already written them I just leave the comments in after I fill the real code in.

I've noticed that my Javascript is usually very readable and doesn't require commenting for the most part. I think using MooTools has a lot to do with it, those libraries all encourage good naming practices.


if a code is changed comments need to change too! Too many times I have seen out dated comments adding confusion to the code. If my code requires great deal of explanation, I go back to my drawing board and redesign the logic.


Very applicable point. I keep on noticing this happen and I would prefer no comments to outdated comments.




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

Search: