top | item 42599728

(no title)

TheBruceHimself | 1 year ago

Copilot is quite good at inferring functionality from comments in code. At least this is what I found. If you break down your function, or whatever it is you are great at making, into steps or sub-processes with comments outlining what each part does, Copilot works a lot better. So for example, I want to sort the lines in a file via a linked list: I might have my first comment say “step1: load text file called bla.TXT into the linked list with one line per node” then leave a gap where code should go before writing a second comment which may go something like “step 2: iteratively go through the list, swapping nodes if they are not in ascending alphabetical order. Do this until the list is ordered”. From there prompting the AI to complete the code based on the comments works fairly well.

I will say that Copilot is sometimes embarrassingly wrong. It’s strange how brilliant it can be at times and how incredibly dumb it can be other times. I think that just comes as part of the technology right now, but I have made it write quite complex code using the above approach. This approach does, however, require you to understand how the problem should be solved as to have Copilot understand enough to take over.

discuss

order

No comments yet.