• abhibeckert@lemmy.world
    link
    fedilink
    English
    arrow-up
    6
    arrow-down
    1
    ·
    edit-2
    11 months ago

    // write a function to invert a string

    That’s not how I use it at all. I mean I started out doing that, but these days it’s more like this (for anyone who hasn’t used copilot, the grey italic text is the auto-generated code - tab to accept, or just type over it to ignore it):

    Sure - I totally could have written the constructor. But it would have taken longer, and I probably would’ve made a few typos. And by the way it’s way better than copying from Stack Overflow, because it knows your coding style, it knows what other classes/etc exist in your project, etc etc.

    It’s also pretty good at refactoring. You can tell it to refactor something to use a different coding pattern for example, and it’ll write 30 lines of code then show you a git style diff.

    Not to mention you can ask questions about your code now. Like “how has X been implemented in this 20 year old project I started working on today?” Or one I had the other day “I’m getting this error, what files might be causing that?” It gave me a list of 15 files and I was able to find it in a few minutes. The error had no context for me to figure it out.

    • Eager Eagle@lemmy.world
      link
      fedilink
      English
      arrow-up
      2
      ·
      edit-2
      11 months ago

      I second this. GH Copilot for coding is an amazing tool, not just for boilerplate, but to fill complementary logic, brainstorm test cases, rewriting and refactoring, reducing typos or “copy and paste” errors, documentation, prototyping code from a human-written description, and probably several other things at different levels of competence.

      Makes me wonder what people that don’t find it useful are trying to do with it. Sure you’ll probably need or want to change some things, but that’s miles ahead of having to write it from zero.

      Hell, if you start declaring a function with a good name and good names + types for the arguments, it’ll often write an implementation that is mostly correct using the rest of the file as context.