Live data from Hacker News

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

news.ycombinator.com

11–20 of 59 posts

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

#11
If you're going to enable a coding agent with this much authority, you could, for instance, have two layers of agents which review the changes in context of the project as you described, providing the dev agent the appropriate feedback to fix its own errors.

Have all that closed loop before anything makes it to a pull request that a human sees.

Add an agent to write unit tests for all impacted modules, etc.

Essentially coding is just coding, something has to also do the software engineering.

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

#12
I have dealt with some codebases that were purely assembled with ML and they tend towards being completely unmaintainable nightmares exhibiting all the worst tenets of things like object-oriented code design. Levels of inheritance 8 modules deep, global variables being passed around everywhere to escape them, the works.

For ML driven code development, I find it works best when I used it to make pure functions where I know exactly what I expect to go in and out of the function, and the LLM can simultaneously write the tests for it to ensure that it works. LLMs do not plan like humans, even when finetuned they seem to have difficulty being integrative with knowledge beyond pattern matching.

That being said, 90% of coding is pattern matching to something someone made already. And as long as I'm writing pure functions and providing suitably adequate context for what the model needs to produce, LLMs seem to work wonders. My rule of thumb is to spend 10-20 minutes specifying exactly what I need in the prompt, and then tuning that if I fail to get the expected result.

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

#13
If you've hired an intern before, think of Cursor like that. When you come up with an intern project plan, you usually need to give a very clear specification of what you expect, and you usually need to have the project be pretty self-contained. A lot of real problems are really bad intern projects, and a lot of problems are a really bad fit for AI. You have to be strategic about it.

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

#15
IMO the biggest issue is that instead of reviewing the code of your colleagues, you review some random generated stuff. You know what kind of code you can expect from your colleagues, not anymore. Also you expect that code reviews promote knowledge and consistency amongst the team and helps them to become better in programming. Not anymore either.

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

#16
I've thought about this and one thought is:

How does AI making breaking changes or not following established patterns differ from human developers (possibly novices) doing the same?

Which safeguards do you have against human developers randomly copying code from StackOverflow, and why aren't they enough against developers using AI-generated code?

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

#18
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 mobile app in Swift, then switch to my embedded device prototype and write a UART driver for a GPS module under ESP32.

I’ve been programming for many years but this level of productivity would have been unimaginable to me without AI.

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

#20

It sounds like you're not training it with your existing code base, and that you're running it with relatively small contexts. Have you done any custom LLM training on your code base, and what model are you using?

Who is training models on a code base? That's an extraordinary use case.
Post reply on HN