• Solar Bear@slrpnk.net
    link
    fedilink
    English
    arrow-up
    8
    arrow-down
    4
    ·
    edit-2
    1 year ago

    Never ask ChatGPT to write code that you plan to actually use, and never take it as a source of truth. I use it to put me on a possible right path when I’m totally lost and lack the vocabulary to accurately describe what I need. Sometimes I’ll ask it for an example of how sometimes works so that I can learn it myself. It’s an incredibly useful tool, but you’re out of your damn mind if you’re just regularly copying code it spits out. You need to error check everything it does, and if you don’t know the syntax well enough to write it yourself, how the hell do you plan to reliably error check it?

    • _danny@lemmy.world
      link
      fedilink
      arrow-up
      6
      ·
      1 year ago

      You absolutely can ask it for code you plan to use as long as you treat chatgpt like a beginner dev. Give it a small, very simple, self contained task and test it thoroughly.

      Also, you can write unit tests while being quite unfamiliar with the syntax. For example, you could write a unit test for a function which utilizes a switch statement, without using a switch statement to test it. There’s a whole sect of “test driven development” where this kind of development would probably work pretty well.

      I’ll agree that if you can’t test a piece of code, you have no business writing in the language in a professional capacity.