5 ms·
> 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 book
by mandeepj 4y ago
> 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
- layer8 4y agoIt’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.
- lolc 4y agoShort 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?
- layer8 4y agoI believe I understand most of those, but what’s a dead-on implementer?
- lolc 4y agoNot looking beyond the next line to solve a task.
- mandeepj 4y ago> 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/Presentation/Nop.Web.Framework/WebWorkContext.cs#L204 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/coreclr/gc/gc.cpp https://raw.githubusercontent.com/dotnet/runtime/main/src/co...