工程師真心話:AI 幫我寫程式,但也讓我踩了幾個坑

AI 寫程式到底好不好用?作為一個天天用的工程師,我說:超好用,但也有幾個坑我踩得很痛。這篇聊聊它真正幫到我的地方,還有那些「看起來對、跑起來爆炸」的時刻。

I've been writing code for over a decade. When AI editors first emerged, I was skeptical. But after using one for a year, I've become dependent on it - although I've also fallen into a few pitfalls that kept me up late at night. This article isn't meant to idolize or disparage AI editors, but rather to share my genuine experience as an engineer.

What truly changed my workflow is "template time"

Let's start with the good. The greatest value AI has brought to me isn't about writing complex algorithms, but about eliminating "boring but necessary" tasks.

Writing API templates, configuration files, and repetitive CRUD operations, or converting data from one format to another - these are tasks I can do with my eyes closed, but they're time-consuming and tedious. Now, with AI editors like Cursor, I can describe what I need and have it generated for me, which I then review. Previously, these tasks took up about 30% of my day; now they take up less than 10%. The time I've saved is spent on more valuable tasks, such as designing architecture and solving difficult bugs.

I must admit: AI hasn't made me a better engineer, but it has freed me from mundane tasks, allowing me to focus on more important work.

Pitfall 1: It's good at "looking right"

Now, let's talk about the downsides. The most dangerous aspect of AI-generated code is that it can look perfectly logical and reasonable, but still be incorrect.

I once fell into a painful trap when an AI gave me a code snippet for handling dates that looked flawless, with clear logic and naming conventions. I thought it was fine and merged it, only to have it explode when dealing with time zones, causing issues in production and keeping me up late at night to fix. Upon reviewing the code again, I found that the bug was hidden in a subtle boundary condition that the AI hadn't considered, and I had missed it because the code "looked so professional".

The lesson learned: The more perfect AI-generated code looks, the more thoroughly it needs to be reviewed. It's not that AI can't make mistakes, but it can make them with confidence.

Pitfall 2: It doesn't understand the context of your entire project

The second pitfall is that AI is very good at understanding "this piece of code", but often fails to understand "your entire system".

It might give you a technically correct solution that doesn't follow your project's conventions or duplicates a wheel that already exists, simply because it's unaware of the existing tool functions. This kind of "locally correct but globally out of place" code can accumulate and make your project increasingly messy.

To avoid this, I now explicitly tell the AI about my project's conventions and ask it to follow existing practices, rather than letting it freely generate code.

Pitfall 3: Over-reliance can lead to atrophy

This point is more subjective, but I've genuinely felt it. There was a period when I relied too heavily on AI, to the point where I wouldn't even bother thinking about basic things myself and would just ask the AI. As a result, when I faced a whiteboard question in an interview without the aid of AI, I got stuck - not because I didn't know the answer, but because I had gotten out of practice thinking from scratch.

Now, I make a conscious effort to allocate time for "writing code myself", especially for core logic and areas I want to learn. AI is meant to accelerate my work, not replace my thinking. I need to find a balance.

How I use AI now

After a year, my principle is simple: let AI handle tasks that I can do but don't want to spend time on; I'll handle tasks that require judgment, understanding, and growth.

I use AI for templates, conversions, syntax checks, and writing tests. For architecture decisions, security, core logic, and debugging difficult issues, I do it myself, with AI acting as an advisor at most. I always review every line of code generated by AI, especially the lines that look the most perfect.

AI has indeed sped up the coding process, which is a fact. However, it has also increased the cost of "not understanding but copying". The more powerful the tool, the more aware its user needs to be. For more development tools, you can refer to AI Programming Tool Recommendations.

Frequently Asked Questions

AI 寫的程式碼可以直接用嗎?

不建議照單全收。它常「很有自信地錯」,越看起來完美越要仔細 review,尤其邊界條件、安全性與跨系統脈絡。

AI 會讓工程師變弱嗎?

過度依賴會讓基本功生疏。建議讓 AI 做樣板與雜事,核心邏輯與想成長的部分自己寫,刻意保留練習。

AI 編輯器最適合做什麼?

最適合砍掉「無聊但必要」的樣板時間(CRUD、設定、格式轉換、寫測試),讓你把時間留給架構與難題。

繁體中文版 →