AI Can Write Your Code, But Can You Still Understand It? The Developer's Guide to Avoiding AI Dependency
本文为原文前 6,000 字符的节选翻译,完整内容请查看原文。
AI Can Write Your Code, But Can You Still Understand It? The Developer’s Guide to Avoiding AI Dependency
人工智能以几年前几乎无法想象的方式改变了软件开发。如今,即使编程经验很少的人也可以描述一个应用程序,要求人工智能助手生成代码,并在几分钟内获得看起来像是一个功能性产品的成果。
Artificial intelligence has changed software development in ways that would have seemed almost impossible a few years ago. Today, someone with little programming experience can describe an application, ask an AI assistant to generate the code, and receive something that looks like a functioning product within minutes.
开发人员无需手动编写每个组件即可生成整个网站。以前需要花费数小时搜索才能解决的错误,有时可以在几秒钟内得到解释。文档、调试建议、测试用例甚至架构建议都变得更容易获取。这确实令人兴奋。
A developer can generate an entire website without manually writing every component. Errors that previously required hours of searching can sometimes be explained in seconds. Documentation, debugging suggestions, test cases and even architectural recommendations are becoming easier to access. This is genuinely exciting.
然而,有一个重要的问题值得更多关注:我们是在成为更好的开发人员,还是仅仅变得更擅长要求人工智能编写代码?这两者并不一定是一回事。人工智能可以提高我们生产软件的速度,但速度本身并不能保证理解力、可靠性或技术成长。
However, there is an important question that deserves more attention: Are we becoming better developers, or are we simply becoming better at asking AI to write code? These two things are not necessarily the same. AI can increase how quickly we produce software, but speed alone does not guarantee understanding, reliability or technical growth.
一个能生成 5000 行代码却无法解释这些代码如何工作的开发人员,可能拥有一个功能正常的应用程序,却不具备维护它所需的知识。本文探讨了将人工智能作为开发合作伙伴与对其产生依赖之间的区别。更重要的是,它提供了一种在不牺牲使人成为称职开发人员的技能的前提下使用人工智能的实用方法。
A developer who can generate 5,000 lines of code but cannot explain how those lines work may have a functioning application without having the knowledge required to maintain it. This article explores the difference between using AI as a development partner and becoming dependent on it. More importantly, it provides a practical approach to using AI without sacrificing the skills that make someone a capable developer.
软件开发的新现实
The New Reality of Software Development
曾经有一段时间,学习开发软件需要花费大量时间来理解编程语言、阅读文档、试验代码和排查错误。如果你想构建一个计算器,你需要了解输入是如何工作的、计算是如何执行的以及结果是如何显示的。
There was a time when learning to develop software required spending considerable time understanding programming languages, reading documentation, experimenting with code and troubleshooting errors. If you wanted to build a calculator, you needed to understand how inputs worked, how calculations were performed and how results were displayed.
如果出了问题,你必须进行调查。你可能会花整个下午的时间发现,条件语句中的一个小错误导致了意想不到的结果。今天,体验不同了。你可以向人工智能助手解释你的需求,并要求它构建计算器。它可能会生成 HTML、CSS 和 JavaScript,包括计算逻辑和界面。
If something broke, you had to investigate. You might spend an entire afternoon discovering that a small mistake in a conditional statement was responsible for an unexpected result. Today, the experience is different. You can explain your requirements to an AI assistant and ask it to build the calculator. It might generate the HTML, CSS and JavaScript, including the calculation logic and interface.
这改变了所涉及的手动工作量。但也改变了学习过程。传统上,开发人员通常通过自己构建东西的挣扎来学习。他们遇到问题,进行调查,并逐渐理解系统不同部分是如何交互的。
This changes the amount of manual work involved. But it also changes the learning process. Traditionally, developers often learned through the struggle of constructing something themselves. They encountered problems, investigated them and gradually developed an understanding of how different parts of a system interacted.
人工智能可以消除其中的一些挣扎。这并不自动意味着是坏事。开发人员不应该浪费数小时去解决那些可以快速解释的问题。挑战在于识别哪些挣扎是不必要的,哪些有助于你作为工程师的发展。
AI can remove some of that struggle. That is not automatically bad. Developers should not have to waste hours solving problems that can be explained quickly. The challenge is recognising which struggles are unnecessary and which ones contribute to your development as an engineer.
例如:花三个小时寻找一个丢失的分号可能价值不大。理解为什么计算产生错误结果是有价值的。让人工智能解释一个不熟悉的 API 可以加速学习。在不了解其安全影响的情况下复制 API 实现可能会产生严重的问题。目标不应该是避免使用人工智能。而应该是以一种让你变得更有能力而不是参与度更低的方式使用人工智能。
For example: Spending three hours searching for a missing semicolon may not be particularly valuable. Understanding why a calculation produces an incorrect result is valuable. Asking AI to explain an unfamiliar API can accelerate learning. Copying an API implementation without understanding its security implications can create serious problems. The objective should not be to avoid AI. It should be to use AI in a way that makes you more capable rather than less involved.
隐藏的问题:理解债务
The Hidden Problem: Understanding Debt
开发人员对技术债务很熟悉。当捷径或不完美的实现决策导致以后必须解决的额外工作时,就会产生技术债务。还有另一个值得认识的问题:理解债务。当你积累了无法充分解释的代码、工具、依赖项和架构决策时,就会产生理解债务。
Developers are familiar with technical debt. Technical debt occurs when shortcuts or imperfect implementation decisions create additional work that must be addressed later. There is another problem worth recognising: understanding debt. Understanding debt develops when you accumulate code, tools, dependencies and architectural decisions that you cannot adequately explain.
想象一下,要求人工智能构建一个个人理财应用程序。第一个版本看起来令人印象深刻。它有仪表板、图表、交易历史、计算和响应式界面。你测试了几个功能,一切似乎都能正常工作。然后你请求额外的功能。人工智能修改了几个文件。之前能正常工作的东西停止了运行。
Imagine asking AI to build a personal finance application. The first version looks impressive. It has a dashboard, charts, transaction history, calculations and a responsive interface. You test a few features, and everything appears to work. Then you request additional functionality. AI modifies several files. Something that previously worked stops functioning.
你让它修复问题,它又修改了另一个部分。经过几次迭代,你的应用程序在不断增长。但你不再完全确定:哪个函数控制交易计算?用户数据存储在哪里?当输入为空时会发生什么?不正确的值是如何处理的?哪些组件依赖于被修改的函数?最新的更改是否引入了另一个问题。
You ask it to fix the problem, and it changes another section. After several iterations, you have a growing application. But you are no longer entirely certain: Which function controls the transaction calculations? Where is user data stored? What happens when an input is empty? How are incorrect values handled? Which components depend on the modified function? Whether the latest changes introduced another problem.
你积累功能的速度超过了你积累理解的速度。这就是理解债务。在维护应用程序、调查意外行为或引入新功能时,它可能会变得特别昂贵。问题不在于人工智能编写了代码。问题在于开发人员接受了实现决策,却没有发展出足够的知识来评估它们。
You have accumulated functionality faster than you have accumulated understanding. This is understanding debt. It can become particularly expensive when maintaining an application, investigating unexpected behaviour or introducing new features. The problem is not that AI wrote the code. The problem is that the developer accepted implementation decisions without developing enough knowledge to evaluate them.
为什么理解债务很重要
Why understanding debt matters
软件在第一个版本能工作时很少算作完成。真正的应用程序会进化。用户会发现问题。需求会改变。浏览器会引入新的行为。依赖项会收到更新。新功能会与现有功能交互。了解系统的开发人员可以调查这些变化。
Software is rarely finished when the first version works. Real applications evolve. Users discover problems. Requirements change. Browsers introduce new behaviours. Dependencies receive updates. New features interact with existing ones. A developer who understands the system can investigate these changes.
完全依赖人工智能的开发人员可能不得不要求同一个工具来解释它之前生成的系统。这会产生一个循环:人工智能生成代码。开发人员遇到问题。人工智能修改代码。又出现了一个问题。开发人员请求另一次修改。代码库变得越来越难以理解。这不是人工智能辅助开发的必然结果,但这是一个值得避免的模式。
A developer who depends entirely on AI may have to ask the same tool to explain the system it previously generated. That creates a cycle: AI generates code. The developer encounters a problem. AI modifies the code. Another problem appears. The developer requests another modification. The codebase becomes increasingly difficult to understand. This is not an inevitable outcome of AI-assisted development, but it is a pattern worth avoiding.
人工智能应该加速你的思考,而不是取代它
AI Should Accelerate Your Thinking, Not Replace It
处理人工智能辅助开发最有效的方法之一是改变你提出的问题。不要把人工智能当作一台生产成品代码的机器,而要把它当作一个帮助你理解问题和评估可能解决方案的技术助手。考虑两种方法。
One of the most useful ways to approach AI-assisted development is to change the questions you ask. Instead of treating AI as a machine that produces finished code, treat it as a technical assistant that helps you understand problems and evaluate possible solutions. Consider two approaches.