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

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

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

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


当前回答

新的web项目应该考虑不使用Java。

我已经用Java做网页开发超过10年了。起初,与现有的替代方案相比,这是朝着正确方向迈出的一步。现在,有比Java更好的选择。

这真的只是用魔锤方法解决问题的一个具体例子,但它真的很痛苦。

其他回答

单身人士并不邪恶

There is a place for singletons in the real world, and methods to get around them (i.e. monostate pattern) are simply singletons in disguise. For instance, a Logger is a perfect candidate for a singleton. Addtionally, so is a message pump. My current app uses distributed computing, and different objects need to be able to send appropriate messages. There should only be one message pump, and everyone should be able to access it. The alternative is passing an object to my message pump everywhere it might be needed and hoping that a new developer doesn't new one up without thinking and wonder why his messages are going nowhere. The uniqueness of the singleton is the most important part, not its availability. The singleton has its place in the world.

有时使用正则表达式从HTML中提取一些内容是可以的。严肃地说,与迟钝的解析器争论,或者使用快速的正则表达式,如/<a href="([^"]+)">/?这并不是完美的,但是您的软件可以更快地启动和运行,并且您可能还可以使用另一个正则表达式来验证提取的匹配是否确实看起来像一个URL。当然,这很俗气,而且可能在一些边缘情况下失败,但对于大多数使用来说已经足够好了。

基于大量的“如何使用正则表达式获取HTML?”的问题,几乎每天都在这里发布,而且事实上每个答案都是“使用HTML解析器”,这应该是有足够的争议性的。

Xah Lee: actually has some pretty noteworthy and legitimate viewpoints if you can filter out all the invective, and rationally evaluate statements without agreeing (or disagreeing) based solely on the personality behind the statements. A lot of my "controversial" viewpoints have been echoed by him, and other notorious "trolls" who have criticized languages or tools I use(d) on a regular basis. [Documentation Generators](http://en.wikipedia.or /wiki/Comparison_of_documentation_generators): ... the kind where the creator invented some custom-made especially-for-documenting-sourcecode roll-your-own syntax (including, but not limited to JavaDoc) are totally superfluous and a waste of time because: 1) They are underused by the people who should be using them the most; and 2) All of these mini-documentation-languages all of them could easily be replaced with YAML

SESE (Single Entry Single Exit)不是法律

例子:

public int foo() {
   if( someCondition ) {
      return 0;
   }

   return -1;
}

vs:

public int foo() {
   int returnValue = -1;

   if( someCondition ) {
      returnValue = 0;
   }

   return returnValue;
}

我和我的团队发现,在很多情况下,一直遵守这一点实际上会适得其反。

我通常持有相当有争议的、强烈的和响亮的观点,所以这里只是其中的一些:

“因为我们是微软的机构/合作伙伴/专家”从来都不是一个有效的论点。

我现在工作的公司首先把自己定位为微软专家。所以前面提到的论点被抛出了很多次,我还没有看到一个背景下它是有效的。

我不明白为什么要在每一个适用的角落推广微软的技术和产品,而不顾客户和员工的满意度,以及一般的实用主义。

这正是我对软件行业政治深恶痛绝的一个基石。

MOSS(微软Office Sharepoint服务器)就是一坨屎。

有点像第一个观点,但我真的认为MOSS应该被赶出市场。它需要花费大量的授权和设置费用,破坏了web标准,让开发者非常不开心。我还没有看到一个MOSS项目有一个总体积极的结果。

然而,一次又一次,客户找到我们并要求MOSS解决方案。