this post was submitted on 14 Jul 2023
376 points (92.5% liked)

Programmer Humor

19149 readers
1287 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 1 year ago
MODERATORS
376
Finally (programming.dev)
submitted 1 year ago* (last edited 1 year ago) by [email protected] to c/[email protected]
 
top 31 comments
sorted by: hot top controversial new old
[–] [email protected] 31 points 1 year ago (4 children)

Most of the codes I copied from GPT doesn't even work Seems I spent more time fixing it compared to thinking it myself

[–] [email protected] 45 points 1 year ago (2 children)

Seems I spent more time fixing it compared to thinking it myself

AI code is just bad code written by someone else that I now have to fix, and we all know the one job every coder loves is fixing code written by someone who you cannot ask: "why did you do it this way?"

[–] [email protected] 6 points 1 year ago (1 children)

You can definitely ask... It's just the answer might infuriate you even more

[–] WhiskyTangoFoxtrot 3 points 1 year ago

INSUFFICIENT DATA FOR MEANINGFUL ANSWER

[–] [email protected] 1 points 1 year ago

It can be helpful though if you just need to find the right library function of proper syntax in a foreign language. Usually faster than a search

[–] [email protected] 13 points 1 year ago (3 children)

Often when I tell ChatGPT what error its code produced it will immediately figure out what the bug was and fix it.

[–] [email protected] 7 points 1 year ago (1 children)

interacting with chatgpt is a learned skill

i’ve used it several times and while the initial code may have some issues you can get them cleared up with a few direct follow ups

[–] [email protected] 7 points 1 year ago* (last edited 1 year ago) (1 children)

I recall reading a while back of one person's strategy, whenever ChatGPT generates code for him he immediately tells ChatGPT "there's a bug in that code" (without checking or specifying). It'll often find one.

Another approach I've heard of is to tell ChatGPT that it's supposed to roleplay two roles when generating code, a programmer and a code reviewer. The code reviewer tidies up the initial code and fixes bugs.

Since often ChatGPT's code works fine for me I don't usually bother with these steps initially, since I'm usually just wanting a quick and dirty script for a one-off task the quality doesn't matter much in my case.

[–] [email protected] 3 points 1 year ago

And you know what you call changing words around to get a computer to do what you want? That's programming, baby! We are programming programmers!

[–] [email protected] 4 points 1 year ago

Yeah, this is the way how to interact with it. It makes sense as well, because it's only predicting the next word based on the previous words, so it had can in hindsight find a lot more stuff and in general be smarter about it.

[–] [email protected] 3 points 1 year ago* (last edited 1 year ago)

I do this with TypeScript error codes. It’s great at breaking down the problem. I never just copy paste code from it and I don’t think anyone should do that anyway.

[–] [email protected] 9 points 1 year ago (1 children)

The art is the same. AI is just like asking an art student to draw you a picture. Might be good, might look terrible. Don't ask for hands.

[–] [email protected] 6 points 1 year ago

Don’t ask for hands.

or feet.

or animals.

or eyes.

or...

[–] [email protected] 2 points 1 year ago

I’ve never had an issue with it personally but I’ve never asked it to do anything complex either

[–] [email protected] 19 points 1 year ago

I've had success with trivial things, like write a log file parser with this pattern, or give me a basic 3 part left-right-center header in html. Works ok for trivial side projects. I would never trust it in production. Its a tool, nothing more at this point. Like an electric drill, better than a hand crank, but you still need to know how to use it.

[–] [email protected] 13 points 1 year ago

Yea I genuinely hope we get to the point where I don't have write code. Let me describe the architecture and algorithms with my voice in English. I'd much rather spend my time solving abstract problems than typing syntax. If I have to essentially "teach" the AI what I want by dropping down the ladder of abstraction sometimes, that's OK.

[–] [email protected] 8 points 1 year ago

My favourite use of ChatGPT is

Optimize below function

[–] [email protected] 6 points 1 year ago (1 children)

Me a CS student that bet all my future in the field: yes totally happy about this

[–] [email protected] 2 points 1 year ago

Me, with 20 years experience making software: yes, totally happy about this. (This makes it much easier to keep up with the latest newfangled bullshit.)

[–] [email protected] 5 points 1 year ago (2 children)

Then what will you do for money

[–] [email protected] 4 points 1 year ago

Create more ai

[–] [email protected] 2 points 1 year ago
[–] Rhoeri 4 points 1 year ago

Both can suck you know.

[–] [email protected] 4 points 1 year ago (3 children)

It won’t, because AI will generate based on existing content, but will not make something new

[–] [email protected] 11 points 1 year ago

I can't say I make something genuinely new at my daily job

[–] [email protected] 2 points 1 year ago

Wonder if human knowledge is now going to start degrading like a reposted JPEG as AI generated information is recycled again and again into more AI systems.

[–] [email protected] 2 points 1 year ago (1 children)

If AI can write code based on English input then we should be able to feed it a spec and then just deploy to production the output.

[–] [email protected] 4 points 1 year ago

And, as always, attempting to code to that spec will expose contradictions, inconsistencies, and frequently produce something that the customer judges as unfit for purpose.

Coding has never been the toughest problem, except in the matter of security attacks.

[–] hubobes 1 points 1 year ago

I wish it or Copilot would produce useful stuff. I mostly use them to generate regex expressions.

load more comments
view more: next ›