Live data from Hacker News

I'm tired of fixing customers' AI generated code

medium.com

261–270 of 345 posts

Re: I'm tired of fixing customers' AI generated code

#262
post #141

Earlier quoted context omitted.

There's more than one mistake in the code given, and I tried just once. "Create Python code for iterating a file with a cache." class CachedFileIterator: def __init__(self, file_path): self.file_path = file_path self.cache = [] # List to store cashed lines self.current_index = 0 # Index for the current line to read def _read_lines_from_file(self): """Read lines from the file and cache them.""" with open(self.file_pat…

What do you see as mistakes? I see some weirdness, but the spec is just not complete - there was no requirement for rewinding, multiple users, etc. in the request so it's not implemented. The only thing I'd call an actual mistake is using an empty list to mean both an empty file and an uninitialised value.

The file object is named "openFile", but used as "f". The class is defined as "CachedFileIterator", but used as "CacheingFileIterator". That's two typos, before discussing the actual code.

Re: I'm tired of fixing customers' AI generated code

#263

Seems to me like you have an opportunity to develop a couple SDKs in your customers' favorite languages (probably python and typescript) and a simple "Get Started" template that could alleviate a lot of these requests. Show them the base case, let them figure out how to work with your api via an SDK instead of directly with an API and let the advanced users build their own SDKs in whatever language they prefer. Since…

And then the customers will open support requests for code generated by an AI that misuse that very SDK. It doesn't look like OP's issue is with the code per say, only with the lack of skills of its customers, regardless of the code they write...

Re: I'm tired of fixing customers' AI generated code

#264
Another concern is around reviewing it.

I can't tell in a pull request what someone wrote themselves, or to what level of detail they have pre-reviewed the AI code which is now part of the pull request before allowing it to get to me. I can tell you I don't want to be fixing someone else's AI generated bugs though... Especially given that AI writes more/less dry/more verbose code, and increases code churn in general.

Re: I'm tired of fixing customers' AI generated code

#265
post #172

I‘m tired of fixing my colleagues‘ AI generated code. They churn out a lot of code in a short amount of time, but then we loose the saved time again because during pull request review they often cannot explain what this code is actually doing. Maybe I should use an AI for code review, too?

Why are these people employed? Isn’t that a bit like a fake employee who outsources his work behind your back? You can’t work with the guy because he literally doesn’t even know or understand the code he’s pushing to the repo

>Why are these people employed?

After being stuck on a project with a few of them recently, I've started to figure it out.

They know they are incompetent, and are afraid of being around competent people who would call them out. So they link up with other likewise incompetents to maintain a diffusion of responsibility, so the finger can't be pointed at any one person. And when the system they are building inevitably fails horribly, management can't really fire the whole team. So they bumble along and create "make work" tickets to fill time and look like something is happening, or they spend their time "fixing" things that should have never existed in the first place by layering mountains of hacks on top, rather than reassessing anything or asking for help. Rinse and repeat once the project has clearly failed or been abandoned.

Re: I'm tired of fixing customers' AI generated code

#266
post #60

Earlier quoted context omitted.

I knew a guy that made a good living as a freelance web developer decades ago. He would pretty much just copy and paste code from tutorials or stack overflow and had no real idea how anything worked. Using code without understanding it is never a good idea, it doesn’t need to be from AI for that to be true.

>a guy that made a good living ... never a good idea Arguably the term for a bad idea that works is "good idea"

That's fair. From a personal perspective it was a good idea. He regularly had sites get compromised though, so for his customers it wasn't always a good product. He generally kept his customers happy though.

Re: I'm tired of fixing customers' AI generated code

#267
post #3

I'm always a little surprised at how many people out there want to develop software yet haven't put in the effort to gain even the most basic computer nerd programming chops. You see this all the time in the more newbie-friendly game engine communities. Maybe you don't want to pursue a career in software, but anyone can spend a week learning Python or JavaScript. I suspect/hope a lot of these people are just kids who…

I'm not surprised at all. Honestly the "I don't need to learn that" mentality is common in tech even in people who call themselves senior developers. It's especially noticeable in the hostility of many towards the sorts of information you learn in a good computer science degree.

How many arguments have we heard here along the lines of "why teach algorithms universities should be teaching _insert_fad_technology_of_the_day_." Big Oh and time complexity is a special favourite for people to pick on and accuse of being useless or the like. You see it in arguments around SQL vs document databases, people not being willing to recognize that their for loops are in fact the same as performing joins, people unwilling to recognize that yes they have a data schema even if they don't write it down.

So I'm not surprised at all that people would use AI as a substitute for learning. Those same people have likely gotten by with stackoverflow copypasta before gen AI came about.

Re: I'm tired of fixing customers' AI generated code

#268
post #55

I had a related episode at work when my coworker asked me why his seemingly trivial 10 line piece of code was misbehaving inexplicably. It turned out he had two variables `file_name` and `filename` and used one in place of another. I asked him how he ended up with such code, he said he used copilot to create it. Using code from a generative AI without understanding what it does is never a good idea.

Claude gave me something similar, except these were both used, and somehow global variables, and it got confused about when to use which one. Asking it to refactor / fix it made it worse bc it'd get confused, and merge them into a single variable — the problem was they had slightly different uses, which broke everything I had to step through the code line by line to fix it. Using Claude's still faster for me, as it'd…

One thing I've found in doing a lot of coding with LLMs is that you're often better off updating the initial prompt and starting fresh rather than asking for fixes.

Having mistakes in context seems to 'contaminate' the results and you keep getting more problems even when you're specifically asking for a fix.

It does make some sense as LLMs are generally known to respond much better to positive examples than negative examples. If an LLM sees the wrong way, it can't help being influenced by it, even if your prompt says very sternly not to do it that way. So you're usually better off re-framing what you want in positive terms.

I actually built an AI coding tool to help enable the workflow of backing up and re-prompting: https://github.com/plandex-ai/plandex

Re: I'm tired of fixing customers' AI generated code

#269
post #248

Earlier quoted context omitted.

for line in f: is multiple mistakes in a single line.

What are the mistakes there?

The most obvious one:

    with open(self.file_path, 'r') as openFile:
        for line in f:
`f` does not exist. It should be `openFile`.

Re: I'm tired of fixing customers' AI generated code

#270

Another concern is around reviewing it. I can't tell in a pull request what someone wrote themselves, or to what level of detail they have pre-reviewed the AI code which is now part of the pull request before allowing it to get to me. I can tell you I don't want to be fixing someone else's AI generated bugs though... Especially given that AI writes more/less dry/more verbose code, and increases code churn in general.

Just add more AI, that'll solve everything.

[edit] unfortunately I think I need to point out the above is sarcasm. Because there really are people using AI to review AI-generated code, and they do not see the problem with this approach.

Post reply on HN