是时候告别工程学教条了——安东·扎伊德斯
Engineering dogmas it's time to retire

原始链接: https://newsletter.manager.dev/p/5-engineering-dogmas-its-time-to

## 重新思考软件工程的“常识” 本文挑战了软件工程中五种被广泛接受的做法,主张采取更细致的方法。首先,作者质疑自动依赖外部包的做法,引用了left-pad事件和一些出乎意料的简单流行的npm包作为例子,强调了潜在的安全风险和维护负担。 其次,文章提倡重新评估项目管理工具,赞扬Linear简化了团队过渡并提高了问题报告效率。它还批评了强制代码审查,建议采用像Pylon这样的基于信任的系统——根据需要请求审查,并推广结对编程作为替代方案。 作者进一步认为,应该避免迭代冲刺的严格结构,而倾向于像Shape Up这样的更轻松、循环的方法,优先考虑可持续的节奏,而不是“蛮力”。关于功能标志,文章警告不要过度使用,这可能导致代码库复杂化和虚假的安全性。 最后,它挑战了代码*总是*需要自我解释的观点,承认了简洁的注释对未来可维护性的价值。核心信息是,虽然这些做法本身并不*错误*,但有效的工程经理应该批判性地评估它们在特定团队和环境中的价值。

## 工程教条与代码审查讨论 manager.dev 上的一篇文章引发了 Hacker News 上关于淘汰过时工程实践的讨论。一个主要的争论点是减少对传统代码审查的依赖,特别是对于经验丰富的开发者。 许多评论者强调代码审查的价值不仅在于质量控制,更在于**知识共享和团队沟通**,尤其对于初级开发者而言。人们担心,如果经验不足的工程师在没有审查的情况下拥有过多的自主权,可能会导致生产问题。然而,其他人澄清文章提倡*更多*的自主权,但排除了初级团队成员和仍在入职的成员。 对话还涉及代码注释的目的,一位用户分享了包含代码注释的四个理由:解释业务需求、记录研究、证明决策以及解答问题(尽管更倾向于通过重构代码来*避免*注释)。 最后,用户注意到并讨论了文章中嵌入的一则相当明显的 Linear 项目管理工具广告,并争论其作为一种广告形式的适当性。
相关文章

原文

A few months ago, I wrote about 13 software engineering laws, which are observations about how software projects behave.

Today, I’ll cover 5 practices that are considered ‘common wisdom’, and why I think worth reconsidering them.

  1. Don’t reinvent the wheel - find a package

  2. Every PR must be reviewed

  3. 2-4 week sprints are how modern teams work

  4. Every code change should be behind a feature flag/gate

  5. If a comment is needed, the code is too complex

Why waste time writing code that someone already wrote before you?

The CTO of a startup I worked at hated dependencies. We worked with some 3D calculations (software for drones), and he was writing tens of mathematical functions himself. He insisted that even though it’s slower, he at least understands every part and can fix any bug that will pop up, and wouldn’t depend on anyone else for critical parts of our software.

I used to make fun of that paranoia, and he sent me to read some crazy stories:

  • The developer of left-pad took it down from NPM, breaking the builds of Facebook, Spotify, Netflix, and many more. It’s basically an 11-line for loop that adds spaces to a string.

  • The is-even npm package has 160k weekly downloads(!). The author published it back when he was learning to code. Here’s what it does:

yeah…

You are also much more vulnerable to security incidents (and need to spend a significant amount of time chasing updates). In most smaller companies, there is no vetting process for packages (unlike for vendors) - every engineer does as they please.

With LLMs, it’s easier to both get into this mess and get out of it: it’s much easier to install an unneeded dependency by mistake, but it’s also quicker to implement ‘known’ solutions from scratch.

It’s a tricky balance.

Another ‘common wisdom’ among software engineers is that project management software sucks. It’s a necessary evil you just have to deal with.

I also thought this was just part of my job - spending hours chasing engineers to ‘keep the tickets updated’, so I could understand what’s going on and make better decisions. Switching to another tool felt like a huge project that was just not worth it.

Linear took that to heart, and made switching super simple with a 2-way sync, keeping your legacy tool updated.

I haven’t met an engineer who tried Linear and didn’t like it. Teams that switch to Linear see 2x more reported issues - engineers actually want to use the tool. More visibility => fewer meetings => happer engineers.

Read about switching to Linear

Thanks Linear for supporting today’s article!

In every company I worked for in the last 15 years, we had mandatory code reviews (at least one, usually two reviewers per PR).

A couple of months ago I wrote a deeper dive about the price of mandatory code reviews.

In short - they help you improve the quality, but slow you down significantly.

I’m definitely not against code reviews - there is a TON of value in them. What I am against is a lengthy process with strict rules (like having to re-request a review for every commit at a PR, even after it was approved).

I love the process at Pylon: engineers merge their own code and only request reviews if they need input, think they have a risky change, or are still onboarding. Their thought process is: if we hire skilled engineers and trust them, there’s no reason to bottleneck every change with mandatory reviews.

Pair programming is also a great alternative to async reviews.

I believe that sprints are taking the joy out of building software.

If you had to think about the ideal way to organize your team’s efforts, do you honestly think you would have gone with the current way of doing things?

Do you feel it brings the most value to your customers? Do you think your engineers truly enjoy the process, feeling they contribute from their own creativity?

Shape Up is a great alterinative. Here’s the gist of it (from here):

We work in 6-week cycles. Once a cycle is over, we take one or two weeks off of scheduled projects so everyone can roam independently, fix stuff up, pick up some pet projects we’ve wanted to do, and generally wind down prior to starting the next six week cycle.

Note: These are not sprints. I despise the word sprints. Sprints and work don’t go together. This isn’t about running all out as fast as you can, it’s about working calmly, at a nice pace, and making smart calls along the way. No brute force here, no catching our collective breath at the end.

My point is not that you should adopt Shape Up.

It is that there are alternatives to Scrum/Kanban. You can build a way of working that actually fits your team and company, without leaving everyone exhausted.

In many cases, feature flags are ruining your codebase:

Once you introduce the feature flags capability, PMs will come up with other ideas for using it:

  • Why should we rely on developers for the configuration change? Let’s move it to somewhere the PMs can access, and then we’ll be able to do it without bothering anyone.

  • While we are at it, let’s also make it adjustable per user! That way, the PMs can safely release the feature for a couple of users to gather feedback and test it themselves, and only afterwards release it to everyone.

    This is similar to a Canary Release. The difference between them is that a Canary Released feature is exposed to a randomly selected cohort of users while here, the feature is exposed to a specific set of users.

  • And why limit ourselves to using it for turning features on? Let’s put the most resource-heavy feature behind one, and let the Ops people turn it off in case of an unusual overload.

  • Oh and we have those premium users, let’s have some features enabled only for them!

  • One last thing - you can put everything under a feature flag, right? So let’s not risk any changes without it, please hide any bug fix under a flag, in case the fix needs to be reverted.

Thus you find yourself in deep shit, with hundreds of active feature flags - making your codebase more complex and much harder to test.

Feature flags also give you a sense of false security - I’ve seen multiple bugs caused by developers releasing to production code that was supposed to be hidden behind a flag, but wasn’t (especailly in React).

I definitely think you should use feature flags - just not abuse them. It’s ok to just properly test a code change on staging and release it without any flags/gates.

The V1 of commenting advice was: “Comment your code so it’ll be understandable by whoever comes after you”.

Then, the V2 version of the advice gained popularity: “If you need to add comments, it means your code sucks. It needs to be self-explanatory”.

Any extreme doesn’t make sense imo.

Yes, you can write code that will require fewer comments.

Still, in some cases a line or two can save someone else hours of frustration a couple of years in the future.

There are many other ‘common wisdom’ bits, like ‘don’t release on Friday’ and ‘microservices help with scale and ownership’.

None of them, and of the 5 covered in the article, is complete nonsense. There is a reason they became so common.

My point is that good Engineering Managers know to balance such dogmas with reality and constantly assess what’s best for their teams.

  1. Own A Graph by Stay SaaSy

  2. The Hitchhiker’s Guide to Measuring Engineering ROI by Itzy Sabo

  3. Building In Public is scary. Do it anyway. by Elena Verna

联系我们 contact @ memedata.com