这绝对是主观的,但我想尽量避免它变成争论。我认为如果人们恰当地对待它,这将是一个有趣的问题。

这个问题的想法来自于我对“你最讨厌的语言的哪五件事?”问题的回答。我认为c#中的类在默认情况下应该是密封的——我不会把我的理由放在这个问题上,但我可能会写一个更完整的解释来回答这个问题。我对评论中的讨论热度感到惊讶(目前有25条评论)。

那么,你有什么有争议的观点?我宁愿避免那些基于相对较少的基础而导致相当宗教的事情(例如,大括号放置),但例如可能包括“单元测试实际上并没有多大帮助”或“公共字段确实是可以的”之类的事情。重要的是(至少对我来说)你的观点背后是有理由的。

请提出你的观点和理由——我鼓励人们投票给那些有充分论证和有趣的观点,不管你是否恰好同意这些观点。


当前回答

代码中的大多数注释实际上是一种有害的代码复制形式。

我们花了大部分时间维护别人(或者我们自己)写的代码,糟糕的、不正确的、过时的、误导性的注释肯定是代码中最令人讨厌的工件列表的顶部。

我想最终很多人会忘记它们,尤其是那些花盒子里的怪物。

最好集中精力使代码可读,必要时进行重构,并尽量减少习惯用法和奇怪之处。

另一方面,许多课程告诉我们注释几乎比代码本身更重要,这就导致了下面这一行添加了一个注释到invoiceTotal风格。

其他回答

不是工具的问题,是你的问题

每当开发人员尝试做一些新的事情,比如做UML图,任何类型的图表,项目管理,他们首先寻找完美的工具来解决问题。在无休止的寻找后,他们发现没有合适的工具,他们的动机就会枯竭。剩下的就是对缺乏可用软件的抱怨。这是一种洞察力,在没有软件的情况下,要组织的计划夭折了。

好吧,只有你自己在处理组织问题。如果你习惯了组织,你可以使用或不使用软件来完成(大多数人都不需要软件)。如果你不习惯组织,没有人能帮助你。

所以“没有合适的软件”只是没有组织的最简单的借口。

你不能通过计算代码行数来衡量生产力。

每个人都知道这一点,但出于某种原因,这种做法仍然存在!

编写完代码后再编写规格说明。(如果有的话)

In many projects I have been involved in, a great deal of effort was spent at the outset writing a "spec" in Microsoft Word. This process culminated in a "sign off" meeting when the big shots bought in on the project, and after that meeting nobody ever looked at this document again. These documents are a complete waste of time and don't reflect how software is actually designed. This is not to say there are not other valuable artifacts of application design. They are usually contained on index cards, snapshots of whiteboards, cocktail napkins and other similar media that provide a kind of timeline for the app design. These are usually are the real specs of the app. If you are going to write a Word document, (and I am not particularly saying you should) do it at the end of the project. At least it will accurately represent what has been done in the code and might help someone down the road like the the QA team or the next version developers.

宏,预处理器指令和注释是邪恶的。

每个文件只使用一种语法和语言!

//不适用于Make文件或插入真实代码的编辑器宏。

顾客并不总是对的。

在我处理的大多数情况下,客户是产品所有者,也就是“企业”。通常情况下,开发人员只是编写代码,而不试图在产品中提供既定的利益。人们有太多的误解,认为IT部门是“公司中的公司”,这完全是一堆垃圾。

I feel my role is that of helping the business express their ideas - with the mutual understanding that I take an interest in understanding the business so that I can provide the best experience possible. And that route implies that there will be times that the product owner asks for something that he/she feels is the next revolution in computing leaving someone to either agree with that fact, or explain the more likely reason of why no one does something a certain way. It is mutually beneficial, because the product owner understands the thought that goes into the product, and the development team understands that they do more than sling code.

这实际上已经开始引导我们走上提高生产力的道路。如何?由于双方的分歧已经改善了沟通,我们更有可能在过程中更早地走到一起,并就产品定义达成一个互利的解决方案。