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

You seem to consider it a negative to spend time on comments. Why?



> You seem to consider it a negative to spend time on comments. Why?

Not just me. I've heard, read - here at HN, in the industry, blogs, co-workers, other books - the code should be self-explanatory. If it needs comments to explain then either the code author can't write good code or they are overly complicating it. Besides that, over time, comments get obsolete. We've to fight to get capacity to address tech debt. I don't see that time getting used in refreshing the comments


Short vars, long vars. Golfer, extender. Globalist and miniscoper. Class-splitter and method-lumper. Abstract composer and dead-on implementer. Typers, Dicters and Tuplers. I think I've seen them all. But so far I have not worked with a single person who'd not value a well-placed comment.

Can you point me to a codebase that does not use comments, as a model of how that looks in practice?


> Can you point me to a codebase that does not use comments, as a model of how that looks in practice?

Once we actively encourage “comments”, this is what we get. It was totally unnecessary -

https://github.com/nopSolutions/nopCommerce/blob/develop/src...

I welcome this type of comments which does not say the obvious and goes beyond what the code in front of you can’t state -

"// If every heap's gen2 or gen3 size is less than this threshold we will do a blocking GC."

https://raw.githubusercontent.com/dotnet/runtime/main/src/co...


So sometimes comments are good and sometimes they are bad? You know, you should trust the book to be able to make this distinction. Because it does!


Ok! I’m going to trust you with it and buy the book


I believe I understand most of those, but what’s a dead-on implementer?


Not looking beyond the next line to solve a task.


It’s a vocal but minority opinion, certainly a highly controversial one. As an easy example, it’s pretty difficult for code to self-document why a particular implementation approach was chosen. The book actually addresses the points you note.




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

Search: