News for hackers. Stuff that matters.
Re:Microsoft and OpenAI Working on ChatGPT-Powered Bing in C... by pjerem on Wednesday January 04, 2023 @02:00AM (#34242878)
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.

Re:Microsoft and OpenAI Working on ChatGPT-Powered Bing in C... by tommica on Wednesday January 04, 2023 @02:37AM (#34243087)
Just 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.
Re:Microsoft and OpenAI Working on ChatGPT-Powered Bing in C... by riffraff on Wednesday January 04, 2023 @02:55AM (#34243194)
Is 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.

Re:Microsoft and OpenAI Working on ChatGPT-Powered Bing in C... by pjerem on Wednesday January 04, 2023 @03:16AM (#34243280)
> 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.

Re:Microsoft and OpenAI Working on ChatGPT-Powered Bing in C... by scarface74 on Wednesday January 04, 2023 @03:20AM (#34243311)
For some AWS automation scripts I wrote, I was able to ask, “why would you use this” and the answer it gave me was impressive.
Re:Microsoft and OpenAI Working on ChatGPT-Powered Bing in C... by Beltalowda on Wednesday January 04, 2023 @09:02AM (#34245576)
> 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.