• palordrolap@kbin.social
      link
      fedilink
      arrow-up
      2
      ·
      edit-2
      1 year ago

      The last I saw, AI models were very good at explaining what code did at a very superficial level, but not why it’s doing that or why it’s written that way.

      I assume it’s gotten better at that since then. (?)

      e.g. They’d be able to write comments for x = 0 along the lines of “set variable x to 0” but not why it’s being done or even why it might be a good idea.

      Deeper question: What can AIs do with obfuscated code? Can they pick that apart and explain it? What if it’s regular code with misleading function names?

      • Last@lemmy.world
        link
        fedilink
        English
        arrow-up
        1
        ·
        edit-2
        1 year ago

        I don’t know how it would respond to obfuscated code, but it does a pretty good job explaining why things are being done. I use a set of custom instructions to get responses tailored more for the kind of work I do. Every day I ask what it thinks of ____ and I’ll paste a function for it to review. You’ll get really good results if you give it detailed instructions. I like to ask it to come up with a plan before generating any code for me, so that I can ensure every detail is correct first. It only has an issue if you ask it to make sure no lines are longer then 100 characters, because it can’t do math very well.

        It can rename all of your functions and variables if you ask it to. Tell it not to include placeholders in the output if it starts protesting.