this post was submitted on 21 Oct 2024
390 points (96.9% liked)

Programmer Humor

32476 readers
357 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 2 points 3 weeks ago (1 children)

I won't say copilot is completely useless for code. I will say that it's near useless for me. The kind of code that it's good at writing is the kind of code that I can write in my sleep. When I write a for-loop to iterate over an array and print it out (for example), it takes near zero brain power. I'm on autopilot, like driving to work. On the other hand, when I was trialing copilot I'd have to check each suggestion it made to verify that it wasn't giving me garbage. Verifying copilot's suggestions takes a lot more brain power than just writing it myself. And the difference in time is minimal. It doesn't take me much longer to write it myself than it does to validate copilot's work.

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

You can think bigger than that, as an example from the other day, I got it to a Display implementation for all of my error types in rust, it generated nice user friendly error messages based on context and wrote all the boilerplate around displaying them

Also got it to generate a function that generated a unique RGB colour from a user ID, did it first try and I could use it straight away

Both those things would've taken me maybe 15 minutes by hand but I can generate and proofread them in seconds

That said, I don't use copilot I use chatgpt, it's intentional when I use it not just being shoved in my face all the time which might help my opinion of it

[–] [email protected] 1 points 3 weeks ago
func randomRGB(uid int) color.RGBA {
	b := binary.BigEndian.AppendUint64(nil, uint64(uid))
	h := sha256.Sum256(b)
	return color.RGBA{h[0], h[1], h[2], 255}
}

That took me under three minutes and half of that was remembering that RGBA is in the color package, not the image package, and uint-to-bits is in the binary package, not the math package. I have found chatgpt useful when I was working in a different language. But trying to get chatgpt or copilot to write tests or documentation for me (the kind of work that bores me to death), doing the prompt engineering to get it to spit out something useful was more work than just writing the tests/documentation myself. Except for the time when I needed to write about 100 tests that were all nearly the same. In that case, using chatgpt was worth it.