I love AI for doing 'small' programming tasks. I put 'small' in quotes because I don't know how to quantify 'small'.
My Spwnn spelling corrector was written by me. And I've had a task on my mind to put a reverse proxy in front of my several Raspberry Pi computers that are running Spwnn so I could use one URL to run lots of queries, ideally in parallel, on my tiny Raspberry Pi datacenter. And it's not that interesting in terms of tech so I've never gotten around to it.
Voila! AI can write this for me!
So I prompt Claude.ai to write a program that will accept a query and forward in a load balanced way to some list of service providers. I'd like it in Go. First attempt worked!
Maybe, I thought, it could also load balance to my AWS instance running spawn. Nope, IP addresses work but not URLs with DNS lookups and paths.
Thus started a back-and-forth where I tried to get Claude to write what I wanted. It was simultaneously cool and illuminating watching Claude edit and hack on the code it had written. It constantly made simple mistakes; and then it made some complicated mistakes. I felt like I was correcting a junior programmer who just kept trying hack after hack to fix other hacks.
Ultimately I gave up. Also Claude seems to have forgotten the whole chat session! I can't find it my history.
I think the better solution going forward is to start from scratch each iteration until you have a prompt that produces what you want. Unless your change is trivial, like "Don't import that module "io" you're not using", your AI programmer buddy will just start digging a deep hole of hackery when you ask it to modify its code too much.
Still, I liked the first solution, and it could even serve as an outline for me to add features.
People are 'vibe coding' and I think that works better for languages where there are more code examples online (i.e., Javascript!).
No comments:
Post a Comment