《实用程序员》的作者忘记了 YAGNI 吗?
务实程序员非常很多人推荐。我刚刚读完它,我明白为什么人们推荐它,尽管我会指出《Code Complete》更深入地涵盖了几乎所有相同的材料。
然而,让我烦恼的一件事是作者从未提到灵活性、概括性和为未来发展留出空间的任何缺点。这些概念都非常好,但是 YAGNI(你不会需要它)的原则发生了什么,它阻止了开发人员浪费时间来实现永远不会被使用的灵活性?
对 SO 的搜索显示了 400 个有关 YAGNI 的问题,所以我怀疑这个概念对作者来说太晦涩了。当然,我的经验远不如他们,那么为什么他们在整本书中没有提到任何限制的使用呢?
谢谢。
The Pragmatic Programmer is highly recommended by many people. I've just finished reading it, and I can see why people recommend it, although I would point out that Code Complete covers almost all of the same material in much more depth.
However, one thing that bugged me was the way the authors never mentioned any downsides of flexibility, generalising, and leaving room for future development. Those concepts are all very good, but what happened to the principle of YAGNI (You Ain't Gonna Need It), which prevents developers wasting their time implementing flexibility that's never going to be used?
A search of SO reveals 400 questions about YAGNI, so I doubt the concept was too obscure for the authors. I am, of course, nowhere near as experienced as them, so why didn't they mention any use of restraint throughout the book?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
他们不称之为 YAGNI,但第 11 页上有一个关键字至少具有相同的焦点:
知道何时停止!
They don't call it YAGNI, but there is keyword on page 11 that has at least the the same focus:
Know When to stop!
他们没有忘记。我认为这本书早于 YAGNI 出名的时间。
They didn't forget. I think the book just predates YAGNI becoming well known.
实现灵活性并不一定需要更多时间。根据我的经验,它可以(并且应该)成为您自然编程风格的一部分。恕我直言,不灵活的代码通常是由于糟糕的编程实践造成的。
Implementing flexibility doesn't necessarily take more time. In my experience it is something that can (and should) be part of your natural programming style. IMHO code that is inflexible is generally due to poor programming practices.