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

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

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

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


当前回答

过分遵守标准会妨碍简单。

MVC对于网站来说被高估了。主要是VC,有时是M。

其他回答

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;
}

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

意识到有时候足够好就是足够好,这是你作为程序员价值的一大飞跃。

请注意,当我说“足够好”时,我的意思是“足够好”,而不是碰巧有用的垃圾。但话又说回来,当你时间紧迫的时候,“一些碰巧有用的垃圾”可能被认为是“足够好的”。

继承是邪恶的,应该被摈弃。

事实是,在任何情况下,聚合都更好。静态类型的OOP语言不能避免继承,它是描述方法想从类型中得到什么的唯一方法。但是动态语言和鸭子类型可以没有它。Ruby mixins比继承强大得多,也更可控。

像SharePoint这样的内部网框架让我觉得整个企业世界是一只把头埋在沙子里的巨大鸵鸟

我在这里不仅仅是在谈论MOSS,我也使用过一些其他的企业内部网产品,绝对没有一个是好的,但是SharePoint (MOSS)是目前为止最差的。

Most of these systems don't easily bridge the gap between Intranet and Internet. So as a remote worker you're forced to VPN in. External customers just don't have the luxury of getting hold of your internal information first hand. Sure this can be fixed at a price $$$. The search capabilities are always pathetic. Lots of time other departments simply don't know about information is out there. Information fragments, people start boycotting workflows or revert to email SharePoint development is the most painful form of development on the planet. Nothing sucks like SharePoint. I've seen a few developers contemplating quitting IT after working for over a year with MOSS. No matter how the developers hate MOSS, no matter how long the most basic of projects take to roll out, no matter how novice the results look, and no matter how unsearchable and fragmented the content is:

每个人仍然在继续使用和购买sharepoint,经理们仍然非常努力地假装它不是撒旦的产物。

微格式

Using CSS classes originally designed for visual layout - now being assigned for both visual and contextual data is a hack, loads of ambiguity. Not saying the functionality should not exist, but fix the damn base language. HTML wasn't hacked to produce XML - instead the XML language emerged. Now we have these eager script kiddies hacking HTML and CSS to do something it wasn't designed to do, thats still fine, but I wish they would keep these things to themselves, and no make a standard out of it. Just to some up - butchery!

我认为使用goto语句是很好的,如果你以一种理智的方式使用它们(以及一种理智的编程语言)。它们通常可以使您的代码更容易阅读,并且不会强迫您使用一些扭曲的逻辑来完成一件简单的事情。