3 ms·
Have you tried a query like this ? Add documentation to this method : [paste a method in any language] For me the results have been impressive. It’s even mor
by pjerem 4y ago
Have you tried a query like this ?
Add documentation to this method :
[paste a method in any language]
For me the results have been impressive. It’s even more impressive if you are not English speaking because it explains what the code does but also translates your domain terms in your own language.
More than code generation I see a really concrete application in having autogenerated and up to date documentation of public methods. It could be generated directly in your code or only by your IDE to help you in absence of human written documentation.
Other interesting things it can does is basic code review by proposing a « better » code and explaining what and why it changed something.
It can also try to rewrite a given code in another language. I haven’t tried a lot of things due to the limitations in response size but for what I tested, it looks like it is able to convert the bulk of the work.
While I’m not really convinced by code generation itself (a la copilot) I truly think that GPT can be a really powerful tool for IDE editors if used cleverly, especially to add meaning to unclear, decade old codebases from which original contributors are long gone.
And knowing that what is hard is not writing but reading code, I see GPT to be a lot more useful here than helping writing 10 lines in a keystroke.
- tommica 4y agoJust tried this out, and this is great! As you say, code-generation is iffy, but for documentation this is something that can really help with.
- riffraff 4y agoIs this really valuable documentation? A common advice for documentation is "why not how", I'm not sure you can do "why" by looking at the "how". You can do javadoc style params, and there's some value there,but not much.
- pjerem 4y ago> A common advice for documentation is "why not how", I'm not sure you can do "why" by looking at the "how". You are right. It’s the rule when you write the doc. But when you are let alone in an unknown codebase, having your IDE summarize the "what" in the auto completion popup could be really useful. Especially in codebases with wrong naming conventions.
- scarface74 4y agoFor some AWS automation scripts I wrote, I was able to ask, “why would you use this” and the answer it gave me was impressive.
- Beltalowda 4y ago> A common advice for documentation is "why not how", I'm not sure you can do "why" by looking at the "how". The "why" is important for inline comments, but for function and method comments I think the biggest is neither "why" nor "how", but "what". As in, "what does this method do?" especially with regards to edge cases. I tried a few methods just now; it gives okay-ish docs. Lots of people don't write great comments in the first place, so it's about on-par. Sometimes it got some of those edge cases wrong though; e.g. a "listFiles()" which filters our directories and links isn't documented as such, but then again, many people wouldn't document it properly either.
- deleted 4y ago[deleted]