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

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

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

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


当前回答

在很多情况下,使用正则表达式解析HTML是可以的

Every time someone posts a question on Stack Overflow asking how to achieve some HTML manuipulation with a regex, the first answer is "Regex is a insufficient tool to parse HTML so don't do it". If the questioner was trying to build a web browser, this would be a helpful answer. However, usually the questioner wants to do some thing like add a rel tag to all the links to a certain domain, usually in a case when certain assumptions can be made about the style of the incoming markup, something that is entiely reasonable to do with a regex.

其他回答

自动更新会导致软件质量更差,更不安全

这个想法

一个系统,以保持用户的软件最新的错误修复和安全补丁。

现实

产品必须在固定期限内交付,这通常是以牺牲QA为代价的。为了在截止日期前发布带有许多漏洞和安全漏洞的软件,他们知道“自动更新”可以在以后用来修复所有问题。

真正让我想到这一点的软件是VS2K5。起初,它很棒,但随着更新的安装,软件慢慢变得更糟。最大的问题是宏的丢失——我花了很长时间创建了一组有用的VBA宏来自动化我写的一些代码——但显然有一个安全漏洞,而不是修复它,宏系统被禁用了。Bang有一个非常有用的功能:记录击键并重复回放。

现在,如果我真的是偏执狂的话,我可以把自动更新看作是一种让人们通过缓慢安装更频繁地破坏系统的代码来升级他们的软件的方法。当系统变得越来越不可靠时,用户就会被诱惑去购买下一个版本,因为它承诺有更好的可靠性等等。

斯基兹

That (at least during initial design), every Database Table (well, almost every one) should be clearly defined to contain some clearly understanable business entity or system-level domain abstraction, and that whether or not you use it as a a primary key and as Foreign Keys in other dependant tables, some column (attribute) or subset of the table attributes should be clearly defined to represent a unique key for that table (entity/abstraction). This is the only way to ensure that the overall table structure represents a logically consistent representation of the complete system data structure, without overlap or misunbderstood flattening. I am a firm believeer in using non-meaningful surrogate keys for Pks and Fks and join functionality, (for performance, ease of use, and other reasons), but I beleive the tendency in this direction has taken the database community too far away from the original Cobb principles, and we jhave lost much of the benefits (of database consistency) that natural keys provided.

那么为什么不两者都用呢?

绝大多数正在开发的软件在收集需求时不涉及最终用户。

通常只是一些经理提供“需求”。

我有一些…凡事都有例外,所以这些并不是一成不变的,但它们确实适用于大多数情况

没有人关心您的网站是否经过验证、是否严格遵守XHTML、是否符合标准或是否有W3C标记。

It may earn you some high-fives from fellow Web developers, but the rest of people looking at your site could give a crap whether you've validated your code or not. the vast majority of Web surfers are using IE or Firefox, and since both of those browsers are forgiving of nonstandards, nonstrict, invalidated HTML then you really dont need to worry about it. If you've built a site for a car dealer, a mechanic, a radio station, a church, or a local small business, how many people in any of those businesses' target demographics do you think care about valid HTML? I'd hazard a guess it's pretty close to 0.

大多数开源软件都是无用的、过于复杂的垃圾。

Let me install this nice piece of OSS I've found. It looks like it should do exactly what I want! Oh wait, first I have to install this other window manager thingy. OK. Then i need to get this command-line tool and add it to my path. Now I need the latest runtimes for X, Y, and Z. now i need to make sure i have these processes running. ok, great... its all configured. Now let me learn a whole new set of commands to use it. Oh cool, someone built a GUI for it. I guess I don't need to learn these commands. Wait, I need this library on here to get the GUI to work. Gotta download that now. ok, now its working...crap, I can't figure out this terrible UI.

sound familiar? OSS is full of complication for complication's sake, tricky installs that you need to be an expert to perform, and tools that most people wouldn't know what to do with anyway. So many projects fall by the wayside, others are so niche that very few people would use them, and some of the decent ones (FlowPlayer, OSCommerce, etc) have such ridiculously overcomplicated and bloated source code that it defeats the purpose of being able to edit the source. You can edit the source... if you can figure out which of the 400 files contains the code that needs modification. You're really in trouble when you learn that its all 400 of them.

和这里的大多数人一样,我尽量遵循DRY和不做人工编译器等原则。

我想推广的另一个策略是“告诉,不要问”。而不是混乱的所有对象与getter /setter本质上是他们的筛子,我想告诉他们做一些事情。

这似乎直接违背了具有愚蠢实体对象和较厚服务层的良好企业实践(这需要大量的请求)。嗯,想法?