News for hackers. Stuff that matters.
Re:Ask HN: What is your best advice for a developer to write... by davidsawyer on Wednesday June 29, 2016 @11:16AM (#12002145)
I'd caution not to use commenting as a crutch, though. Code really ought to be readable and easy to follow all on its own. I don't think code should be littered with comments just narrating what's going on, since those can get out of sync easily when code is modified. The code itself ought to be descriptive enough to "tell its own story", so to speak. Comments ought to explain why something is happening if the author feels the code may be unclear.
Re:Ask HN: What is your best advice for a developer to write... by brianwawok on Wednesday June 29, 2016 @11:28AM (#12002240)
Agreed. If I find myself typing a detailed comment past TODO FIX THIS TOMORROW, I refactor. It is rare code should need a comment. Pulling a clever trick to trick the JIT into inlining a function call? Cool add a comment. Just loading junk form a database to show a user? Should not use a comment.