使用 AI 會產生脆弱的程式碼庫
AI usage generates a fragile codebase
Hacker News 用戶討論使用 AI 是否會令程式碼庫變得脆弱,原帖標題主張 AI 使用會產生脆弱的程式碼庫。留言者看法不一:有人稱維護 500k LOC 的程式碼庫 7 個月未遇到明顯脆弱問題,也有人分享評測結果,指出 Opus 5.5 在 Fable 5.1 程式碼庫上的實作準確度較高、token 用量較低。
Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
AI usage generates a fragile codebase (evanxmerz.com) 67 points by plun91 hour ago | hide | past | favorite | 53 comments help
beastman8218 minutes ago | next[–] Try using a statically typed language, refined types, and functional programming. Your tests become limited to things that are hard or impossible to assert with the type system. My code has never been stronger. reply
agumonkey8 minutes ago | parent | next[–] which one did you use ? ocaml ? haskell ? scala ? just curious, and tempted to do the same, so far I don't like the code made by llms in dynamic languages codebases reply
hk__210 minutes ago | parent | prev | next[–] Meh, if the LLM has a flawed logic it’ll implement bad code and bad tests. Tests will pass, but the logic will still be broken. reply
dimbletimbers9 minutes ago | parent | prev | next[–] Can you provide any evidence for your claim? reply
haolez11 minutes ago | parent | prev | next[–] Haskell? reply
user4392821 minutes ago | prev | next[–] After 7 months and a 500k LOC codebase I can say that in my experience the fragility is inconsequential. Disclaimer: I have no SaaS platform, it's a mobile app. In my experience maintenance does not suffer long term with codebase size, if anything it became easier with model advances. Most people talking about suboptimal implementation, fragility, and maintenance burden seem to theorize and extrapolate with no actual experience in implementing a large project with AI. I can't blame them, I see the same in my day job, but the results after 500h+ on a separate project show that the concerns do not manifest in practice. reply
glimshe11 minutes ago | parent | next[–] Tell us more. What I'm gathering from your comment is that you have a personal monster project (500k LOC) fully/mostly developed by AI and you're having no problems maintaining it. Can you understand anything in the codebase? Has the maintenance cost (in AI tokens) been going up as the project keeps growing? Are users happy? Also, sharing a link would be great if you're comfortable with the idea. reply
jvidalv9 minutes ago | parent | prev | next[–] Same, I maintain a really healthy mountaineering app (6K users), I started it where we where still pasting into chat-gpt, and now fully autonomous with Claude Code. Codebase has never been better and healthier, and any tech debt that has been accumulated after a few releases can be removed in a few prompts when you are out of product ideas and have some free tokens to spare. (I added US mountains and trails btw: https://fescims.com ) reply
nahumfarchi6 minutes ago | parent | prev | next[–] I recently spent a couple of hours reducing 1k lines of code produced by an LLM to about 100. Purely extrapolation, but imagine what if your project was 50k instead of 500k? reply
emehex18 minutes ago | parent | prev | next[–] Available in the AppStore? Would love to see it! reply
hk__27 minutes ago | parent | prev | next[–] Was it a preexisting 500k LOC codebase, or has the whole codebase been generated by LLMs? reply
Topfi8 minutes ago | parent | prev | next[–] Purely for the models running your code base, have you ever ran an assessment of what that fragility costs you? Tool call error frequency, unnecessary test failures that the model then addresses but wouldn’t in a more parsable code base, inefficiency in navigation, anything of that sort? A model landing changes doesn’t mean it does it well. I have seen all those when running a fairly new eval inspired by something I read in the ts-rust repo, giving a simple GPT-6 Astra code base to Opus 5.5. Implementation accuracy was higher and token usage lower when Opus 5.5 got a Fable 5.1 built code base of the same feature set and coverage compared to the fragile GPT one. Incidentally I struggled to parse the latter but not the former. Yes, a modern model will happily work on the most unmaintainable slop (doesn’t even need to be LLM derived slop, we have all seen bad Human written code) and that is great if you have an old code base to maintain. But if one can avoid it, even if one uses only models and never looks at the code, being efficient has value. Heck, rewrites are doable and affordable now, I have restarted projects and the gains were quickly apparent, even if we just look at model usage efficiency gains. reply
gonzalohm8 minutes ago | parent | prev | next[–] 7 months is not long term... reply
madaxe_again4 minutes ago | parent | prev | next[–] I have a similar position - maintainability of code written by AI no longer matters in any meaningful way, as as the models advance, one simply rewrites. At the current pace, the very idea of maintaining software will become as relevant as the idea of trimming wicks, stropping razors - or making every frame you take with a camera count. When the marginal cost of replacement drops to a sufficiently low level, the entire paradigm changes. I say this as someone with 30+ years of development experience, who built everything to be maintained until the heat death of the universe. I just don't think it's a relevant question in this brave new world. reply
retrac9811 minutes ago | prev | next[–] My experience has been sort of the opposite. In the past 6 months I don’t think I’ve introduced a single production bug through my work, which is unheard of (for me, at least). LLM code is verbose, and often quite inflexible, but that rigidity and verbosity tends to come from the AI being very thorough about ensuring the code does exactly what’s expected, and it seems to leave much less room for error as a result. It acts as a really good forcing function for specificity on requirements, and for thinking through "what if" scenarios. reply
pamcake2 minutes ago | parent | next[–] in order to make sense of this comment it would help to know what kind of codebase(s) you are referring to like what language and application(s). reply
fxwin5 minutes ago | prev | next[–] > Here are the four most common ways that I have seen AI generating a fragile codebase. / Four signs that you have a fragile codebase It would be nice if the listed symptoms (which have their own issues, e.g. "AI writes overly complex code" - overly complex for who?) were backed up with numbers or at least case studies, rather than stating "this is how you can recognize that X is happening", then stating "X is happening" in the title. reply
stevefan199930 minutes ago | prev | next[–] This is absolutely right because AI lacks Fingerspitzengefühl: https://architecturenotes.co/p/the-cost-of-ai-in-code-goodby... reply
amelius22 minutes ago | parent | next[–] AI doesn't "lack" it, it just may have less of it, and the gap is closing. Like it or not. reply
dofm4 minutes ago | root | parent | next[–] An LLM can't have intuition itself. It can only simulate the outcomes of intuition in its training set. The likely uncloseable gap is that some intution is unspoken, literally felt by the brain's default mode network. LLMs basically never shower, do the washing up, kick their foot in the dirt while sitting on a park bench with a coffee: the domain of the default mode network. reply
gonzalohm7 minutes ago | root | parent | prev | next[–] You think that AI understands your code deeply, and the purpose and context that exists outside your code? reply
amelius1 minute ago | root | parent | next[–] For all intents and purposes, yes. reply
dreambigwrkhard6 minutes ago | prev | next[–] The market will fix itself. If the article is correct: AI generated codebase creates incidents that are more severe and take longer to recover from, companies will dial it back after they get burned bad enough. If it's a skill issue: Maybe some coders can push the frontier out even a lot more than others before such things happen. Then the problem is the human in front of the screen. reply
soon_to_be_sb33 minutes ago | prev | next[–] Every once in a while something comes up that proves beyond a doubt that 99% of human beings on planet earth cannot think for themselves. And most sensible things that human beings do, they do by following the herd or "instructions". reply
tupac_speedrap10 minutes ago | parent | next[–] Simmer down lad, you are sounding like a Redditor. reply
CharlieDigital36 minutes ago | prev | next[–] it doesn't have to. AI is great at following patterns and loves to write tests. Start with good patterns that most teams would not have the discipline to write by hand and it is possible to get very robust code. reply
catmanjan20 minutes ago | parent | next[–] Read his first point bro reply
ink18 minutes ago | prev | next[–] The question is, is it really a problem when letting agents rewrite everything better costs not that much. reply
softwaredoug3 minutes ago | prev | next[–] AI coding requires a lot of care to observability and verification. If you can’t measure the problem, is it really a problem? A lot of assertions about code fragility seem to merge in with bike shedding arguments about style and what one person sees as readable. But in the end if you have 100k of slop but we can know with high levels of certainty it does what it needs to - does it matter? reply
rokkamokka38 minutes ago | prev | next[–] AI Without Oversight Considered Harmful :) reply
amelius17 minutes ago | prev | next[–] We just need new Software Engineering books that explain how to build software in the AI age. reply
gonzalohm6 minutes ago | parent | next[–] And people will ask AI to read it for them reply
snarfy23 minutes ago | prev | next[–] Business incentives create fragile codebases. AI is a force multiplier in whatever you apply it to. Most software companies output binaries with new features, whether it runs locally or on a server. Binaries with new features. None of the business owners give a shit about what is in the binary. It may be extremely fragile and only work for one type of user, but if they only have one type of user nobody cares. Most software doesn't keep evolving forever and at some point gets rewritten as a 2.0 version or whatever, so the quality was never as important. It doesn't have to be that way. You can use AI just as effectively to produce quality source code as you can slop binaries. It depends on the business priorities and what is actually important. The caveat is if you are the one engineer on the team trying to use AI the right way to produce quality source instead of binaries as fast as possible, you might get left behind or let go since your work no longer aligns with the business. reply
ricardobeat30 minutes ago | prev | next[–] Imagine a junior engineer in the same position: they write shallow tests, they write overly complex code. What do you do? You provide guidance, support and tooling so they can write better tests and code. You supervise and help them meet the standard. It is the same with AI agents (including the challenge of how to carry that knowledge around and transfer it). You are responsible. You are also responsible for the understanding part: know what is being worked on, glance at changes, inspect the outcomes, cross-check specifications, tests, product requirements. The 'moving too quickly' idea is the other side of the same coin; it is your responsibility to keep track of things and decide what's worth intervention. The exact same thing happens in a project where you have ten developers (or 200) working together — you cannot possibly read all of the code they write. Seeing all of these as downsides is a choice. reply
ernst_klim11 minutes ago | parent | next[–] > You provide guidance For that you need to actually read the code and it's somehow in odds with the whole vibecode idea. Plus it won't give you the 10x boost the management expects. Only not looking at the code will. reply
cassianoleal15 minutes ago | parent | prev | next[–] When I guide a junior engineer, I'm helping a human being become a better version of him/herself, who also helps me grow as a human being and will contribute with their unique ideas and world view, to the team, the organisation, the industry and society. When I do the same with an LLM, I'm just repeating the same guidance over and over again out of frustration just to get something done. Comparing an LLM to a junior engineer is frankly a disgrace. reply
majorbugger22 minutes ago | parent | prev | next[–] And you end up rewriting this stuff yourself. reply
ako14 minutes ago | root | parent | next[–] If you are a bad senior, yes. If you are a good senior you train the junior so his output will improve and you train the agent so its output will improve. reply
gonzalohm4 minutes ago | parent | prev | next[–] So what's the point of the tool then? So much for saving time, if I have to mentor it like a junior I much rather have a person to mentor reply
CurleighBraces43 minutes ago | prev | next[–] Humans not using their own brains and relying on AI to think for them creates a fragile code base. I say that as a frustrated slop fighter. reply
tarkin22 minutes ago | parent | next[–] It seems obvious--and correct me if I'm wrong--that using AI requires less mental effort; and a less exerted mind is a weaker mind. A weaker mind will continue to create more and more fragile code. reply
jansport12338 minutes ago | parent | prev | next[–] we'll recalibrate eventually based on understanding what level of abstraction we can operate on. If these code bases become unmanageable then the trend will correct itself. reply
n4r935 minutes ago | root | parent | next[–] I can't imagine a broad movement of devs using AI more thoughtfully without a widespread incentivisation from employers. And I can't imagine the latter at all. We'll probably just have to cope with more brittle/fragile codebases. reply
epihelix19 minutes ago | root | parent | next[–] > We'll probably just have to cope with more brittle/fragile codebases. Is this not incentive enough to use AI more thoughtfully? reply
n4r911 minutes ago | root | parent | next[–] It's tricky when it comes to performance evaluation. Metrics like token usage or story point "velocity" are easy to conjure up even though they mean little. The kind of careful work that goes into building robust, maintainable code drags such metrics down, and it's very hard to quantifiably gauge their positive effects. reply
w4der0 minutes ago | root | parent | prev | next[–] Not when many companies still think that they'll die if they don't ship enough new features.
soon_to_be_sb31 minutes ago | root | parent | prev | next[–] >we'll recalibrate eventually based on understanding what level of abstraction we can operate on... This would be at the level of helper functions < 10 lines of code. reply
lynx9733 minutes ago | parent | prev | next[–] > I say that as a frustrated slop fighter. That part was obvious, no need to explain it. reply
jojobas19 minutes ago | prev | next[–] AI non-usage brings about irrelevance under pressure from competitors with fragile codebase. reply
elzbardico13 minutes ago | prev | next[–] We shouldn't worry about that. We should be grateful about the mountains of technical debt, because that will be the social security of the post boomers generations: working till death fixing the last hurrah of the boomers. reply
Topfi26 minutes ago | prev | next[–] I do agree with some parts but not others. Reverting a flawed changed, e.g. should have never been as difficult as I have seen it been in some orgs before the advent of LLMs. Same for poor UX landing, both are issues that sure, may be thrown into sharper relief now, but were issues in some code bases and not others and remain that way today. More over, they are issues which can be permanently addressed in the former and in the later are one of the key sources of differentiation today. On code readability, shallow tests and general quality, I can agree emphatically, though not universally. In other words, there are models which write the densest, hardest (for me) to parse code and tests that break with the lowest load/timing deviations yet proof less than nothing. These do that regardless of how much one ships in my experience however so I wouldn’t attribute this to the velocity and more poor data at the heart. I know this reads a bit like “you are using the wrong model” and I understand if someone testing e.g. an OpenAI models understandably extrapolates across all models and considers poor parse-ability in code a likely result of velocity, but you can always step back and work slower, plus, for what it’s worth, I struggle to parse OpenAI code when running their models through my evals after step 7 which is still a fairly measured in scope code base. Essentially, I have seen LLMs, even the newest frontier, produce barely legible slop when building simple CRUD and I have seen a massive rewrite of the existing Firefox code base using APZ to enable an infinite canvas of browser tiles grow in a manner where, even at this stage having replaced a lot outside Places and Gecko, I can walk through changes made and explain the logic, as well as look at any part I haven’t been in for a while and find my bearing even without assistance. Whatever model you use, however much you trust it, if you can get a grip and explain what something does, that puts you in great shape. It also, for what it’s worth, helps future changes by better models to land with higher token efficiency and accuracy. I have put Opus 5.5 into a GPT-6 Astra written code base and it could land features, but the rework the model did along the way was eye opening. I then repeated, explicitly enforcing no changes beyond the initial scope which Opus 5.5 still could succeed in, but took far longer, far more tool calls and significantly more tokens then that change should have taken. I also have examples where any model can be more error prone and slower than myself, though those are unique and I myself have been told I was using the wrong model and sucked at prompting. Use models like any tech if you want for what you feel comfortable for or don’t, both can yield good or bad outcomes. I was and still am an enthusiastic Flutter/Dart dev, which with pub.dev meant I drew in a lot of external packages of dubious quality and compatibility, that I never read. LLM output, I do read and can go beyond my manual contributions in understanding because of it. Doesn’t mean model use doesn’t enable me to do more. Code was, for me, always a means to an end, enabling something. That hasn’t changed and never needed more LOC or massive scope. reply
cyanydeez29 minutes ago | prev[–] The silent part is "undirected". You can patch these holes by observing them and the author us aware. By itself, these are the flaws. I think speed is the biggest flaw though. If i could get variable speed while planning vs building, thatd change some things. I run local models, so i am mostly in the slow lane. When patching these flaws, i want it to read the code parts and diagnose quickly. When its coding, i want to see the problems its encountering with the prompt. I usually observe its thinking a few rounds and if it misunderstands, i redirect. But in all of this, i want a dial that just speeds up once i feel its doing the right thing. SOTA today, to me, would put a model floor like qwen3.8-flash-next on a platform i can dial up the speed. Thats all. I think many of us will bring our own harness, so the only hard point is how dumb the engineers tools are. Since im building local, my tools do a lot more management. So.e of tge opinions i see on HN trigger a "skill issue" reflex because we have a whole shopping mall now if tools and the incurious seem oblivious to how these models are used by cloud providers. Learning about the raw capabilities of LLMs makes getting them to "do the right thing" is now just a job description. Lastly, the last decade of tech oligarchy exposes how little education elites had about humanity and wicked problems. Elon musk reinventing public transportation several times ignorantly. The fact that a social program requires the consent of the people it helps. LLMs are a stark lesson in the difficulty of knowing all the constituent parts and still being unable to predict outcomes. Welcome to Socioligy 101 tech nerds. reply
fragmede16 minutes ago | parent[–] > Elon musk reinventing public transportation several times ignorantly. In interviews, he admitted that the Hyperloop was intended to mess up the California High Speed Rail project because trains are boring. It's the opposite of ignorance, it's malice. Hanlon's inversion. reply
Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact Search:
來源:Hacker News:AI 熱帖 · news.ycombinator.com