功利编程之死
4 分•作者: pyeri•8 个月前
功利主义编码定义如下:你编写的代码应该*直接*有用,或者服务于至少一个真实人类的利益。这可能看起来有些抽象或模糊,所以举例可能会有所帮助。例如,我不认为*框架*是功利主义代码。你所创建的就像一个相框的“框架”,其他人(用户)会拿它来画出实际的图片。虽然你确实帮助了部分过程,但充其量也只是间接的。你在这里是供应链的一部分,而不是团队的一部分。
一个运行在某个 Unix 服务器上的巧妙而诙谐的 bash 脚本也不是功利主义编码,没有人类直接从中受益。
库可以算得上是功利主义的,至少比框架更甚。至少它们为用户提供了开箱即用的可重用功能,如日志记录、扫描条形码、从 URL 获取数据等。但同样,有很多间接性和短暂的生命,在这个过程中,我的朋友,你从实现和生活中学到了什么?
我坚信,我们人生的目的不仅仅是学习技术,还包括生活中其他非技术性的东西(比如生活本身)。通过将自己划分到库、框架、规范、包管理器、构建和工具等领域,过去十年中,许多程序员已经与生活本身的复杂性和互动脱节了。
我认为大约十年前(即 2014-15 年左右),功利主义编码走向了终结。直到那时(主要是桌面编程)占据主导地位的编程本质上是高度功利主义的。你过去会为客户开发一个 Winforms 应用程序,其中包含实际的文本框、下拉菜单和按钮,这些都是根据他们的特定需求和领域知识量身定制的,还有什么比这更功利主义的呢!你过去会获得领域专业知识,而不仅仅是技术专业知识。
随着事情开始向云端转移,最终用户和程序员之间的互动越来越少,功利主义编码也开始消亡。当一群被称为“敏捷专家”、“Scrum Master”、“技术倡导者”、“思想领袖”等的新型专家开始介入程序员和最终用户之间时,前者的角色开始转变,变成了只关注技术,而对其他一切置之不理的鸵鸟政策。我们开始失去对领域专业知识的触觉,并被打上“python 程序员”、“PHP 脚本编写者”、“Web 开发人员”、“AI 开发人员”等的标签。这就是人们开始炮制更多框架、库、包、模板、辅助脚本等,而不是关注与利益相关者一起解决实际问题的原因。
这就是目前的大部分情况,桌面开发和其他形式的功利主义编码仍然在某个地方保持着它们的小众地位,但它们只是一个小众。但这并不是一个健康的发展,也不是长期的可持续发展。我强烈认为,这个泡沫迟早会破裂,并且会再次回归功利主义编码。即使是云本身也需要更加功利主义,那里有很多不必要的混乱,可以简化。
你觉得呢?请在评论中告诉我。
查看原文
Utilitarian coding is defined as follows: <i>The code you write should be *directly* useful or serve the interest of at least one actual human being.</i> It might appear somewhat abstract or vague, so examples might help. For example, I don't consider <i>frameworks</i> as utilitarian code. What you create are like the "frames" of a picture box, someone else (the user) will take it and draw the actual picture. Though you did help with part of the process, it's indirect at best. You're part of the supply chain here, not part of the team.<p>A clever and witty bash script running on a unix server somewhere is also not utilitarian coding, no human ever directly benefited from it.<p>Libraries can be somewhat utilitarian, at least more than frameworks. At least they provide some reusable functionality to the user out of the box like logging, scanning a barcode, fetching data from a URL, etc. But again, a lot of indirection and little lasting time, what did *you* learn about implementation and life in that process my friend?<p>It's my strong belief that our life's purpose isn't just about learning technology but also other non-technical things in life (such as life itself). By compartmentalizing themselves into libraries, frameworks, specifications, package managers, build and tooling, etc, many coders over the last decade have sort of divorced themselves from the intricacies and interaction with life itself.<p>A decade ago from now (i.e. circa 2014-15) is where I'd say utilitarian coding came to an end. The kind of programming that prevailed until then (mostly desktop programming) was highly utilitarian in nature. You used to develop a Winforms App for the client, with actual textboxes, dropdowns and buttons, tailored to their specific requirements and domain knowledge, what could be more utilitarian than that! You used to gain domain expertise and not just technology expertise.<p>As things started moving to the cloud, the interaction between the end-user and programmer became less and less, that's when utilitarian coding started dying too. As a new breed of specialists called "Agile Experts", "Scrum Masters", "Tech Advocates", "Thought Leaders", etc. started inserting themselves between the coder and end user, the former's role started morphing as the ostrich policy of dealing only with technology and nothing else. We started losing touch with domain expertise, and became branded as "python coder", "PHP scripter", "web developer", "AI developer", etc. That's how folks started churning out more frameworks, libraries, packages, stencils, helper scripts, etc. instead of worrying about actual problem solving with the stakeholders.<p>This is how things stand right now for the most part, desktop development and other forms of utilitarian coding have still maintained their small niche somewhere, but they're just a niche. But it's not a healthy development, nor is it sustainable long term. I strongly feel that this bubble is waiting to burst one day soon, and there will be a reversion towards utilitarian coding again. Even the cloud itself needs to be more utilitarian, a lot of needless clutter out there which can be simplified.<p>What do you think? Let me know in comments.