Ask HN:手写代码还有意义吗?
3 分•作者: fnoef•3 个月前
尊敬的 HN 社区,我有一个问题:纯手工编写代码是否还有意义?让我来详细说明一下。
首先,我并非指那些需要“快速迭代”或强制使用大型语言模型(LLM)的环境。我更倾向于指那些你可以按照自己的意愿,而不是雇主的意愿来工作的环境。
其次,我不是指那种“帮我构建下一个 Twitter 克隆”的提示,而是指在你完成初步设计后,针对非常小的任务进行提示,例如:“创建一个添加列 [x] 的数据库迁移,该列不允许为空”、“在此表单中添加一个字段,该字段接受字符串值,并在后端根据此格式进行验证,然后将其保存到列 [x]”。基本上,就是用通俗的英语编写代码。
我为什么会问这个问题?我认为自己动手编写代码有助于更好地学习,但同时,如果你已经完成了所有的思考,现在只是通过提示来获得一个花哨的自动补全,那么我们可以说最困难的部分(设计)已经完成了,而你只是为了写而写,跳过了实际的编写过程。另一方面,我担心如果我停止在仍然可以手工编写代码的环境中这样做,我将失去思考代码和理解代码的能力。
您对此有何看法?
查看原文
Dear HN, I have a question: Does it still make sense to write code purely by hand? Let me clarify.<p>First of all, I'm not talking about environments where you need to "move fast" or where your required to use LLMs. I'm referring more to an environment where you do it on your own terms, rather than on the terms of the employer.<p>Secondly, I'm not talking about prompting "Build me the next twitter clone", but rather prompting very small tasks after you have made the initial design, something along the lines of "Create a database migration that adds column [x], not null", "add a field to the this form that will accept string value, validate it on the backend against this format, and save it to column [x]". So basically, writing code in plain English.<p>Why do I ask? I believe that writing something yourself helps you learn it better, but at the same time, if you did all the thinking and now just prompting for a fancy auto-complete, we could argue that the hardest part (the design) was already done, and you skip the writing for the sake of writing. On the other hand, I am afraid that if I will stop writing code in environments where I can still do it, I will lose the ability to think about code and understand code.<p>Whats your take on this?