Comment on How to properly document code?
silas@programming.dev 1 year agoI know there are documentation generators (like JSDoc in JavaScript) where you can literally write documentation in your code and have a documentation site auto-generated at each deployment. There’s definitely mixed views on this though
CookieOfFortune@lemmy.world 1 year ago
To my knowledge that just formats existing comments. With LLMs you could probably do 95% of the actual commenting.
superb@lemmy.blahaj.zone 1 year ago
Useful comments should provide context or information not already available in the code. There is no LLM that can generate good comments from the source alone
silas@programming.dev 1 year ago
Codium does surprisingly well at generating JSDoc, and it processes your code within the context of your entire codebase. Still not quite there yet but you might be surprised
CookieOfFortune@lemmy.world 1 year ago
Why wouldn’t it be able to? It can link similar code structure to data in its training set. Maybe the ones that aren’t at that level but it’s hardly a stretch to make these inferences. Most of the code you write is hardly novel.
superb@lemmy.blahaj.zone 1 year ago
If it’s not exactly novel, how many comments do you really need?
An LLM is just gonna describe the code it sees. Good comments should include information and context that is not already in the source.