Live data from Hacker News

Ask HN: Teams using AI – how do you prevent it from breaking your codebase?

news.ycombinator.com

21–30 of 59 posts

Re: Ask HN: Teams using AI – how do you prevent it from breaking your codebase?

#21
post #19

I mostly copy and paste to and from AI Chats, have it sometimes write a "complete feature or class" but either read the diff between the generated code and the previous existing one thoroughly or test it and go back and forth with the LLM.

This is similar to how do you prevent copying and pasting from Stackoverflow doesn't break your code or how do you prevent an intern from breaking your code.

Re: Ask HN: Teams using AI – how do you prevent it from breaking your codebase?

#22

Small functions, small modules, small codebases. Keep state as contained as possible. Tightly control interfaces and interactions. Know your paradigms. Example: in Rust multi threading it loves putting things in an Arc. You have to tell it to use MPSC queues instead. I love coding with AI. It has made me 100x more productive. I am able to work on my distributed event processing backend in Rust, then switch to my mobi…

Just curious have you been working in those disciplines for years though regarding: rust -> swift -> uart driver gps esp32

Re: Ask HN: Teams using AI – how do you prevent it from breaking your codebase?

#23
IMO these are exactly the right observations given the current tools. Maybe give Augment a try (https://www.augmentcode.com/blog/augment-is-free-for-open-so...). Disclosure: I work there. We've tried hard to improve AI models in these dimensions, but certainly a long way to go. Feedback would be highly appreciated.

Re: Ask HN: Teams using AI – how do you prevent it from breaking your codebase?

#24
post #21
post #19

I mostly copy and paste to and from AI Chats, have it sometimes write a "complete feature or class" but either read the diff between the generated code and the previous existing one thoroughly or test it and go back and forth with the LLM.

This is similar to how do you prevent copying and pasting from Stackoverflow doesn't break your code or how do you prevent an intern from breaking your code.

We still need a human in the loop at the moment to make sure the behavior of the code corresponds to what is expected. If you think about it, breaking the code is breaking the wanted behavior, even when the copy-pasted code might work perfectly.

Re: Ask HN: Teams using AI – how do you prevent it from breaking your codebase?

#27
post #21
post #19

I mostly copy and paste to and from AI Chats, have it sometimes write a "complete feature or class" but either read the diff between the generated code and the previous existing one thoroughly or test it and go back and forth with the LLM.

This is similar to how do you prevent copying and pasting from Stackoverflow doesn't break your code or how do you prevent an intern from breaking your code.

Which are all solved problems: train your humans to check their own work (you don't get a pass just because you copied it) and have code review.

Re: Ask HN: Teams using AI – how do you prevent it from breaking your codebase?

#28
> Some common scenarios I keep running into:

> * AI suggests code that completely ignores existing patterns

> * It recreates components we already have

> * It modifies core architecture without understanding implications

> * It forgets critical context from previous conversations

> * It needs constant reminders about our tech stack decisions

Sounds like a really useful tool!

Serious question: Have you considered just, y'know, learning how to program on your own?

Re: Ask HN: Teams using AI – how do you prevent it from breaking your codebase?

#29
> How often do you catch AI trying to make breaking changes?

I think this is the wrong way to think about the problem. The AI isn't breaking your code, the engineers are. AI is just a tool, and you should always keep this in mind when talking about this sort of thing.

But I understand some of the problems you describe while using AI. And the way I work around is to never let the AI write more than a few lines at a time, ideally it should just complete the line I started to type.

Re: Ask HN: Teams using AI – how do you prevent it from breaking your codebase?

#30
post #21
post #19

I mostly copy and paste to and from AI Chats, have it sometimes write a "complete feature or class" but either read the diff between the generated code and the previous existing one thoroughly or test it and go back and forth with the LLM.

This is similar to how do you prevent copying and pasting from Stackoverflow doesn't break your code or how do you prevent an intern from breaking your code.

True, but I can't figuratively whack an AI agent over the head in a code review and help it learn from the experience of breaking the code. That process is how junior devs become competent software engineers (you know, the ones with enough experience to know if AI generated code will break the codebase in the first place).
Post reply on HN