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

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

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

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


当前回答

软件开发只是一份工作

不要误解我,我非常喜欢软件开发。在过去的几年里,我写了一篇关于这个主题的博客。我在这里花了足够的时间获得了5000声望点。我在一家初创公司工作,通常每周工作60个小时,工资比我作为承包商的工资要少得多,因为团队很棒,工作很有趣。

但从大局来看,这只是一份工作。

它的重要性低于许多事情,如家庭、女朋友、朋友、幸福等,也低于其他如果我有无限的现金供应,我宁愿做的事情,如骑摩托车、驾驶游艇或滑雪。

我认为有时候许多开发者忘记了开发只是让我们拥有生活中更重要的东西(通过做一些我们喜欢的事情来拥有它们),而不是最终目标本身。

其他回答

我有争议的观点: OO编程被极大地高估了[并被视为一颗银弹],实际上它只是工具箱中的另一个工具,没有别的!

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

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

如果你有合适的工具,并花时间正确地编写,那么软件就可以没有错误。

三元操作符绝对糟糕。他们是懒惰编程的典型代表。

user->isLoggedIn() ? user->update() : user->askLogin();

这太容易搞砸了。修订2的一个小变化:

user->isLoggedIn() && user->isNotNew(time()) ? user->update() : user->askLogin();

哦,是的,只是一个“小改变”。

user->isLoggedIn() && user->isNotNew(time()) ? user->update() 
    : user->noCredentials() ? user->askSignup
        : user->askLogin();

哦,糟了,那另一个案子呢?

user->isLoggedIn() && user->isNotNew(time()) && !user->isBanned() ? user->update() 
    : user->noCredentials() || !user->isBanned() ? user->askSignup()
        : user->askLogin();

不不不不。只需要为我们保存代码更改。别再那么懒了:

if (user->isLoggedIn()) {
    user->update()
} else {
    user->askLogin();
}

因为如果第一次就做对了,我们就不必一次又一次地改变你的垃圾三元组:

if (user->isLoggedIn() && user->isNotNew(time()) && !user->isBanned()) {
    user->update()
} else {
    if (user->noCredentials() || !user->isBanned()) {
        user->askSignup();
    } else {
        user->askLogin();
    }
}

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

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.