什么时候意外的功能是一个错误,或者只是糟糕的设计

发布于 2024-10-04 11:42:49 字数 445 浏览 1 评论 0原文

有时,程序员显然在他们的代码结构中做出了故意的选择,导致行为(充其量)不直观,但从技术上来说并不是一个错误,因为它被破坏了。这应该被归类为错误并修复吗?

例如,一个著名的开源电子商务系统(如果您查看我的回答历史记录,您就会知道是哪一个!)提供数量增量功能,管理员可以在其中指定必须添加到购物车的单位的倍数(例如必须是 5、10、15、20 等)。编写代码是为了仅当系统处于“管理库存”模式时(即库存水平随每个订单减少)才强制执行这些限制。现在,店主可能希望以指定的增量销售他们的产品,但不管理库存水平,这是一个完全有效的情况。该代码会默默地忽略配置(不会向管理员提供反馈),并且没有关于打开“管理库存”的要求的文档。

这是一个错误吗?或者只是糟糕的设计/文档。

请注意,我确信有些读者会将这个问题解释为主观的,但我认为错误和糟糕的设计之间存在重要的区别。这在开源项目中尤其重要,其中错误报告往往在与内部公司系统不同的流程中工作。

There are times when a programmer clearly has made a deliberate choice in their code structure that results in behaviour that is (at best) unintuitive but not technically a bug in that it's broken. Should this be classified as a bug and fixed?

For example, a well-known open source ecommerce system (if you look at my answer history, you'll work out which one!) provides functionality for Quantity Increments where an administrator can specify the multiple of units that must added to the cart (e.g. must be 5, 10, 15, 20, etc). The code is written so that these limits are only enforced when the system is in "Manage Stock" mode (i.e. inventory levels are decremented with each order). Now, it is an entirely valid situation that a store owner may wish to sell their product in specified increments, but not manage stock levels. The code ignores the configuration silently (no feedback to the admin) and there's no documentation of the requirement for Manage Stock to be turned on.

Is this a bug? Or just poor design/documentation.

Note, I'm sure that some readers will interpret this question as subjective, but I think there is an important different between bugs and poor design. This is particularly relevant in open source projects where bug reporting tends to work in different processes than internal company systems.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

半世蒼涼 2024-10-11 11:42:49

Bug 意味着行为与程序员的想法不同,而
糟糕的设计意味着程序员预期的行为超出了用户的合理预期。

Bug means behavior different from what the programmer had in mind, whereas
Poor design means that the behavior intended by the programmer is something else than the user can reasonably expect.

半﹌身腐败 2024-10-11 11:42:49

是否有一个规范可以确定一种方法或另一种方法是否正确?如果有规范,那么它就是一个错误。

如果没有规范,那么它可能是糟糕的文档。

当代码默默地忽略配置时会发生错误吗?那么它就是一个错误。

Is there a specification that identifies whether one way or the other is correct? If there is a specification, then it is a bug.

If there is no specification, then maybe it's poor documentation.

Can errors occur when the code ignores the configuration silently? Then it is a bug.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文