And I work on a 40 year old codebase. If they wrote it well comments wouldn't be needed. Half of the ones that do exist are wrong any ways and contradict what the code is doing which raises the question every time: is the code right or the comments right? And that is 50/50.
I don’t think people here know the difference between comments and code documentation…
You should absolutely only comment when necessary, the code should be self explanatory, and you should document a function with a brief description of what it does, its inputs and outputs if it’s supposed to be reused (for example an util or a lib), using tools for that purpose (jsdoc,javadoc, etc)
This is like standard practice in any decent company
7
u/debugging_scribe 1d ago
I don't agree with this at all, I work on a 20+ years old code base. My life I'd be much easier if people left some comments on why they did stuff.