自学前端开发者的编程原则

Like many front-end developers, I don’t have a formal computer science background. I rolled into this discipline as a designer wanting more control over the end product and though I did get a bachelors of ICT degree, the actual studies were, ahem, quite light in terms of “fundamental computer science”. This means all I know about capital-s Software Development, I learned as I went from various sources. If that’s you too, this article hopefully saves you a few years.

像许多前端开发者一样,我没有正式的计算机科学背景。我作为一个设计师进入这个领域,希望对最终产品有更多的控制,虽然我获得了信息与通信技术学士学位,但实际的学习,嗯,关于“基础计算机科学”的内容相当轻。这意味着我所知道的关于大写的 Software Development 的所有知识,都是我从各种来源中逐渐学习到的。如果你也是这样,希望这篇文章能为你节省几年的时间。

After 20+ years, the things that have the most effect on my day-to-day aren’t that I learned how to model my OOP systems using UML or know what a Monad is. Instead, it’s a bunch of (sometimes pithy) statements that fall under the umbrella of “programming principles”.

经过20多年的时间,对我日常生活影响最大的是,我学会了如何使用 UML 建模我的 OOP 系统,或者知道什么是 Monad。相反,影响我最多的是一系列(有时简洁的)陈述,这些陈述属于“编程原则”的范畴。

Now, there are many, many programming principles out there. Some are more like “laws” that describe how systems and people behave (like Hofstadter’s law: It always takes longer than you expect, even when you take into account Hofstadter’s law.) and while those are useful in broader contexts, I don’t find them that actionable when I want to write “good code”.

现在,有很多编程原则。有些更像是描述系统和人类行为的“法则”(比如霍夫施塔特法则:总是比你预期的时间更长,即使你考虑了霍夫施塔特法则。)虽然这些在更广泛的背景下是有用的,但当我想写“好代码”时,我发现它们并不那么可操作。

In this article, I go over the rules-of-thumb that help me write better code as I’m writing code. They don’t require me to write out my entire system before they’re useful, they just help me make better decisions as I go.

在这篇文章中,我将介绍一些帮助我在编写代码时写出更好代码的经验法则。它们不需要我在有用之前写出整个系统,它们只是帮助我在进行中做出更好的决策。

From pithy statements to actual useful habits

从简洁的陈述到实际有用的习惯

When you’re just starting out, at some point someone is going to point at your code and say “Premature optimisation is the root of all evil”. That sounds super serious, but also kind of odd.

当你刚开始时,总会...

开通本站会员,查看完整译文。

首页 - Wiki
Copyright © 2011-2025 iteam. Current version is 2.148.0. UTC+08:00, 2025-11-13 02:59
浙ICP备14020137号-1 $访客地图$