返回首页

对比阅读

对比阅读:AI Discounted a ¥99 Item by 10% — Verification Is the New Bottleneck 与 99 元商品被 AI 打了九折 — 能跑的代码不等于能交付的代码,验收成新瓶颈

AEN
JuejinAI codingcode review·

AI Discounted a ¥99 Item by 10% — Verification Is the New Bottleneck

A "spend 100, save 10" promotion logic: the code AI produced also applied the 10% discount to a ¥99 product. The code runs and outputs numbers — but the result is wrong. This is the point a Juejin tech article this week hammers home: we've noticed that "runnable AI code" and "deliverable code" have never been the same thing.

What this is

This article, aimed at programming beginners, breaks AI code verification into five dimensions: syntax is correct (runs), logic is correct (meets requirements), exceptions are handled (edge cases), the code matches the project's tech stack — the combination of technologies in use, like frontend frameworks or backend languages — and follows code standards, and has been human-verified.

Using the promotion example, the author illustrates a common misjudgment: when developers see AI produce runnable code on the first try, they assume it understood their requirements. But for prompts like "write me a login feature" or "write me a promotion-discount logic" that omit the conditions, AI just guesses the most common case.

The author further flags the pitfalls beginners most often fall into: empty parameters, wrong types, missing fields, edge-value exceptions — plus a more insidious category: AI-recommended dependencies may not exist at all; the code may use deprecated APIs (application programming interfaces); and handling in sensitive scenarios may leave security holes.

Industry view

Supporters argue this article moves the "AI coding" discussion from "can it write" to "does it write well." When enterprises deploy AI coding tools, what stalls them again and again is rarely the generation step — it's verification. That's precisely why this piece deserves attention.

But there is dissent. Senior engineers argue that telling beginners "don't use AI code directly" is fine, but for experienced developers the framing is backwards. The point isn't "should we verify" — it's "how do we automate verification." In their view, treating AI tools as a "reference book" rather than a "collaborator" actually drags efficiency down.

Another overlooked risk is security. The article cites the example: directly concatenating user input into a webpage's innerHTML — a method that renders strings as HTML — will display content normally but leave an XSS (cross-site scripting) vulnerability. AI won't flag these on its own. Humans have to.

Impact on regular people

For enterprise IT: the share of working hours spent on manual code review will rise — especially for sensitive modules involving payments, permissions, and user information. AI has driven "write" costs down; "review" costs have been pushed up.

For individual careers: programmers' focus may shift from "lines of code shipped" to "defining requirements and verifying results." Put differently: people who can describe problems and spot errors are worth more than people who can simply write code.

For the consumer market: in the short term, users may see software updates slow down, because teams now add a verification step between AI generation and release. But once that verification pipeline is running smoothly, final product stability may actually improve.

来源: juejin.cn
BZH
掘金AI编程代码审查·

99 元商品被 AI 打了九折 — 能跑的代码不等于能交付的代码,验收成新瓶颈

一个满 100 减 10 的促销逻辑,AI 给出的代码对 99 元商品也打了九折 — 这段代码能跑、能输出数字,但结果是错的。这是掘金本周一篇技术文章反复强调的事:我们注意到,「能运行的 AI 代码」和「能交付的代码」,从来不是一回事。

这是什么

这篇面向编程新手的文章,把 AI 代码的验收拆成 5 个维度:语法正确(能跑)、逻辑正确(满足需求)、能处理异常(边界情况)、符合项目技术栈(项目所使用的技术组合,如前端框架、后端语言等)和代码规范、经过人工验证。

用满减促销的例子,作者说明一个常见误判:开发者看到 AI 一次就给出可执行代码,就默认它理解了自己的需求。但「帮我写个登录功能」「帮我写个满减逻辑」这类省略条件的提问,AI 只会按最常见的情况猜。

作者进一步指出新手最容易踩的几类坑:参数为空、类型不对、字段缺失、边界值异常;以及更隐蔽的一类 — AI 推荐的依赖可能根本不存在,写法可能用了已废弃的 API(应用程序编程接口),敏感场景下的处理还可能留下安全漏洞。

行业怎么看

支持方认为,这类文章把「AI 编程」的讨论从「能不能写」拉到了「写得好不好」。企业落地 AI 编程工具时,被反复卡住的往往不是生成环节,而是验收环节 — 这正是文章值得被关心的地方。

但也有反对意见。资深工程师认为,对新手讲「不能直接用 AI 代码」没问题,但对熟手来说方向反了。重点不是「要不要验证」,而是「如何把验证自动化」。在他们眼里,把 AI 工具当成「参考书」而不是「协作者」,效率反而被压低。

另一个被忽略的风险是安全。文章举例:把用户输入直接拼接到网页的 innerHTML(一种把字符串按 HTML 渲染的方法)中能正常显示内容,但会留下 XSS(跨站脚本攻击)漏洞。AI 不会主动提醒这些,必须靠人把关。

对普通人的影响

对企业 IT:代码审查(人工 review)的工时占比会上升,尤其是涉及支付、权限、用户信息的敏感模块。AI 把「写」的成本压下来,「审」的成本被顶了上去。

对个人职场:程序员的工作重心可能从「产出代码量」转向「界定需求 + 验收结果」。换句话说,会描述问题、能识别错误的人,比单纯会写代码的人更值钱。

对消费市场:短期内用户拿到的软件可能更新更慢,因为团队在 AI 生成和上线之间多了一道验收;但验证流程跑通后,最终产品的稳定性反而可能提升。

来源: juejin.cn