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

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

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

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


当前回答

缺陷和增强请求是相同的

Unless you are developing software on a fixed-price contract, there should be no difference when prioritizing your backlog between "bugs" and "enhancements" and "new feature" requests. OK - maybe that's not controversial, but I have worked on enterprise IT projects where the edict was that "all open bugs must be fixed in the next release", even if that left no developer time for the most desirable new features. So, a problem which was encountered by 1% of the users, 1% of the time took precedence over a new feature would might be immediately useful to 90% of the users. I like to take my entire project backlog, put estimates around each item and take it to the user community for prioritization - with items not classified as "defect", "enhancement", etc.

其他回答

意见:没有函数定义和返回类型会导致代码灵活易读。

这种观点可能更适用于解释型语言,而不是编译型语言。需要一个返回类型和一个函数参数列表,这对于智能感知来自动记录你的代码是很好的,但它们也是限制。

不要误解我的意思,我不是说扔掉返回类型,或者参数列表。他们有自己的位置。在90%的情况下,它们是利大于弊的。

在某些时候和场合,这是有用的。

编写大量的规格说明是徒劳的。 编写正确的程序是相当困难的,但是编译器、调试器、单元测试器、测试器等使检测和消除大多数错误成为可能。另一方面,当你像一个程序(例如,伪代码,UML)那样编写具有相当详细级别的规范时,你主要是靠自己。如果您有一个工具可以帮助您正确地处理语法,那么您应该感到幸运。

广泛的规范很可能充满bug。 编写人员在第一次尝试中得到正确答案的可能性,与一个类似的大型程序在没有经过测试的情况下没有错误的可能性是相同的。同行评审可以消除一些错误,就像代码评审一样。

删除类。 . net Framework中隐式处理异常的类的数量(类的方法)。和一个哑巴共事是很困难的。

I'd say that my most controversial opinion on programming is that I honestly believe you shouldn't worry so much about throw-away code and rewriting code. Too many times people feel that if you write something down, then changing it means you did something wrong. But the way my brain works is to get something very simple working, and update the code slowly, while ensuring that the code and the test continue to function together. It may end up actually creating classes, methods, additional parameters, etc., I fully well know will go away in a few hours. But I do it because i want to take only small steps toward my goal. In the end, I don't think I spend any more time using this technique than the programmers that stare at the screen trying to figure out the best design up front before writing a line of code.

我得到的好处是,我不必不断地处理那些因为我碰巧以某种方式破坏了它而不再工作的软件,并试图找出停止工作的原因和原因。

我总是对的。

或者叫它讨论设计。但如果我提出了什么,你最好能证明我为什么错了,并提出一个你可以辩护的替代方案。

当然,这只有在我讲道理的时候才管用。幸运的是,我是。:)