Hacker News new | ask | show | jobs
by soul_grafitti 1957 days ago
The two best bits of advice I got about writing code when I started were: 1) start off by saying what you're doing and 2) the is always an 'Else'. "If you can't say in words what your method/function/class/... is doing you probably won't code it right either." Sure I'll leave if off simple stuff but it's really helps me keep focused. And when the debugger suddenly drops me into the middle of something it's a lot faster to scroll to the top to see what is supposed to be going on.

I also agree that's it's complete macho crap about not needing comments. Hell I come back to something I was working on six months ago and don't remember what I was doing. Far better to have some comments telling me than spend time looking back over more code to figure out what this piece is supposed to be doing.