Over the last year I’ve been learning Swift and starting to put together some iOS apps. I’d definitely class myself as a Swift beginner.

I’m currently building an app and today I used ChatGPT to help with a function I needed to write. I found myself wondering if somehow I was “cheating”. In the past I would have used YouTube videos, online tutorials and Stack Overflow, and adapted what I found to work for my particular usage case.

Is using ChatGPT different? The fact that ChatGPT explains the code it writes and often the code still needs fettling to get it to work makes me think that it is a useful learning tool and that as long as I take the time to read the explanations given and ensure I understand what the code is doing then it’s probably a good thing on balance.

I was just wondering what other people’s thoughts are?

Also, as a side note, I found that chucking code I had written in to ChatGPT and asking it to comment every line was pretty successful and a. big time saver :D

  • SuperNerd@programming.dev
    link
    fedilink
    English
    arrow-up
    10
    ·
    1 year ago

    I’m dealing with a new service written by someone who extensively cut and pasted from ChatGPT, got it to “almost done – just needs all the operational excellence type stuff to put it into production”, and left the project.

    Honestly we should have just scrapped it and rewritten it. It’s barely coherent and filled with basic bugs that have wasted so much time.

    I feel maybe this style of sloppy coding workflow is better suited to front end coding or a simple CRUD API for saving state, where you can immediately see if something works as intended, than backend services that have to handle common sense business logic like “don’t explode if there is no inventory” and etc.

    For this dev, I think he was new to the language and got in a tight feedback loop of hacking together stuff with ChatGPT without trying to really understand each line of code. I think he didn’t learn as much as if he would have applied himself to reading library and language documentation, and so is still a weak dev. Even though we gave him an opportunity to grow with a small green field service and several months to write it.

    • funbike@programming.dev
      link
      fedilink
      English
      arrow-up
      1
      ·
      edit-2
      1 year ago

      I wouldn’t consider the bugs chatgpt’s fault, per se. The same could happen by blindly copy/pasting from SO or a template Github project. If you are copy/pasting from anywhere, it’s even more important that you have good automated tests with good coverage, and that you take extra time to understand what you pasted.

      One of the things I do is generate high level tests first, and then the implementation code. This way I know it works, and I can spend extra time reviewing the test code first to make sure it has the correct goal(s).

      Learning is another matter. Personally, ChatGPT has greatly accelerated my learning of libraries and other languages. I’ve also used it to help me grok a block of complex code, and to automatically comment and refactor complex code into something more understandable. But it can also be used as a crutch.