Skip Navigation

ChatGPT - is using it cheating?

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

Edit: Thanks everyone for insightful and considered replies.

I think the general consensus is basically where my head was at - use it as a tool like you would SO or other resources but be aware the code may be incorrect, and the reality is there will be work required to adapt and integrate with your current project (very much like SO) and that's where you programming skills really come in to play.

I think I still have imposter syndrome when it comes to development, which is maybe where the question was coming from in my mind. :D.

55

You're viewing a single thread.

55 comments
  • Over time you'll realize Chatgpt has giant holes.

    As a developer you do use tools every day -- you probably use a rapid gui tool, you use a compiler, you use APIs, and they're things you probably couldn't build on your own. Even under MS-DOS, you're using bios or msdos interrupts. The PC also handles lot of stuff.

    So it's just another tool, and it doesn't do everything so you need to use it as one thing in your pouch. Don't rely on it too much, and be mindful of IP concerns -- ai is like a monkey with a camera legally, you can't copyright whatever it creates.

    • This! Not even 2 months ago I had a classmate be convinced that he could prompt ChatGPT to write a program that could both encrypt and then decrypt files and store the key secured. It didn't do a single one of those things so we got a long way to go until we got ChatGPT Operating Systems.

      • My favorite test for ChatGPT is to ask it to write a function to divide two numbers in 6502 assembly. Not only is there no DIV instruction to rely on, but the 6502 is very register starved, so you get a lot of screwups. Here's one example of what ChatGPT generated:

        ; Inputs:
        ; - A: dividend
        ; - X: divisor
        
        DIVISION:
            LDX #0       ; initialize quotient to 0
            CPX #0       ; check for divide-by-zero error
            BEQ DIVIDE_BY_ZERO
            CLC          ; clear carry flag
        DIV_LOOP:
            CMP X,A      ; compare divisor with dividend
            BCC DIV_DONE ; if divisor is greater, division is complete
            SEC          ; set carry flag
            ROL A        ; shift dividend left
            INX          ; increment quotient
            JMP DIV_LOOP ; continue division
        DIV_DONE:
            RTS          ; return from subroutine
        DIVIDE_BY_ZERO:
            ; handle divide-by-zero error here
            RTS
        

        You can see it immediately overwrites the divisor with the quotient, so this thing will always give a divide by zero error. But even if it didn't do that, CMP X,A is an invalid instruction. But even if that wasn't invalid, multiplying the dividend by two (and adding one) is nonsense.

      • I recently took an "intro to C" course at my university, despite already having some experience - they wouldn't let me test out - so I ended up helping a few of my classmates. Some had made the rookie mistake of "posting the assignment into ChatGPT and hitting enter," whereupon their faces were eaten by nasal demons.

        Here's the worst example I saw, with my comments:

        char* getName() {
            // Dollar store ass buffer
            char name[1];
        
            printf("Enter your name: ");
            // STACK GOES BOOM
            scanf("%s", name);
            
            // Returning stack-allocated data, very naughty
            return name;
        }
        

        Sighs

55 comments