Well written code will tell you what it does, but it can't tell you why it does it. You do need comments to tell you why. So you should find you need some comments, but not to repeat what the code is already telling you.
If your code is self explanatory, is typed, variable names are accurate and your functions and method only go one job, comentes are unnecessary.
This is Bill. Bill writes unreadable code. Bill calls it ‘job security.’ His team calls it ‘a mistake. 😅
Bills code probably looks like this "aa();bb();ab(12);cc(dd());e(14);"
This is Bill Bill writes Code thinking it is easy to readBill does not comment on codeBill leaves his job for other jobBill's reputation in the industry drops because no one knows what Bill did.DON'T be like Bill. Write code thinking about another developer coming behind you in 5 years, where best practices has changed - syntax has changed. And how we are writing right now is old and forgotten. If you are not writing comments (Useful comments) then you are not writing good code.
I’d love to work on the project those are saying that the code should be understandable and self explanatory. This is beautiful in the book but the real world you join a new project and come across some really complex logics and most of the time without nobody to at least explain the context behind the rule it’s just there. I wish people really commented more their code, even though the comment doesn’t reflect the current version anymore. Sometimes a hint of what happening and context is enough to save you from hours of stressful work.
Who is writing code nowdays?
The debate will continue ad nauseum. It is also irrelevant for the most part. The one thing that is unacceptable is the "if it was hard to write, it should be hard to read" bit. One cannot expect that obfuscation and obscurity will guarantee job security. In this day and age it is even more dangerous. In a few minutes I can load that code into an LLM GPT and get exactly what it does - even with the best obfuscation possible.
If your code requires comments to be understood, you should rethink and rewrite it. It should be expressive enough to stand on its own. Furthermore, comments are rarely maintained during refactoring; over time, they cease to reflect the actual logic and become misleading. A disciplined engineer trusts the code over the comments, just as the computer does. The code is the only source of truth.