News for hackers. Stuff that matters.
Re:Ask HN: Was Donald Knuth completely wrong about good prog... by jstx1 on Thursday November 17, 2022 @10:12AM (#33639937)
> Nowadays, programmers are encouraged to write code with minimal comments

No, they aren't. Find a better hobby than asking absurd questions several times a day.

Re:Ask HN: Was Donald Knuth completely wrong about good prog... by bicijay on Thursday November 17, 2022 @10:16AM (#33640019)
What a rude comment? Let the man ask his questions. Dont turn this into reddit with those snarky comments expecting "upvotes" please.
Re:Ask HN: Was Donald Knuth completely wrong about good prog... by 888666 on Thursday November 17, 2022 @10:20AM (#33640084)
I don't believe I comment excessively, but in code reviews I've only ever been told to remove comments rather than to add more while working as a software engineer.
Re:Ask HN: Was Donald Knuth completely wrong about good prog... by whatwherewhy on Thursday November 17, 2022 @11:25AM (#33641193)
I write programs cca 2:1 comments:code and it is consistently praised for its readability during code reviews and by later maintainers that have to add features to it.
Re:Ask HN: Was Donald Knuth completely wrong about good prog... by pencilguin on Thursday November 17, 2022 @10:25AM (#33640164)
I frequently encourage programmers to delete comments. Any comment that answers "what" instead of "why" is a problem solved by deletion.
Re:Ask HN: Was Donald Knuth completely wrong about good prog... by jjgreen on Thursday November 17, 2022 @11:22AM (#33641152)
Literate programming is not really comments, rather documentation and code combined. Whether that's a good idea is another question, it never really caught on. But when you have TeX and TAOCP in your back pocket, a couple of flops is no great shakes.
Re:Ask HN: Was Donald Knuth completely wrong about good prog... by JoeMayoBot on Thursday November 17, 2022 @02:13PM (#33644064)
Programming practices vary over time and depend on the preferences of those writing the code. There are some, myself included, who believe the naming conventions and organization of the code should be meaningful to make it easier for other developers to read the code. Typically, if code is complex, a comment might be justified, though it often indicates that the code needs to be simplified. Typically, if I write a comment, it will mostly be something along the lines of why we took this approach or any dependencies that aren't obvious. That said, documentation comments (e.g. classes and methods) are useful for automated tools that help developers see API specs or automated swagger/openid UIs.