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

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

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

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


当前回答

依赖管理软件弊大于利

我在Java项目中工作过,其中包括超过100个不同的库。在大多数情况下,每个库都有自己的依赖项,而这些依赖库也有自己的依赖项。

像Maven或Ivy这样的软件应该通过自动获取每个库的正确版本,然后递归获取其所有依赖项来“管理”这个问题。

问题解决了,对吧?

错了。

下载库是依赖项管理的简单部分。困难的部分是创建软件的心理模型,以及它如何与所有这些库交互。

我不受欢迎的观点是:

如果你不能口头解释,在你的头脑中,你的项目中所有库之间的基本交互,你应该消除依赖直到你可以。

同样地,如果列出从某个函数直接或间接调用的所有库(及其方法)所用的时间超过10秒,那么您在管理依赖关系方面做得很差。

您应该能够轻松回答“我的应用程序的哪些部分实际上依赖于库XYZ?”

当前的依赖关系管理工具弊大于利,因为它们很容易创建极其复杂的依赖关系图,而且它们实际上没有提供减少依赖关系或识别问题的功能。

我见过开发人员包含了10或20 MB的库,在项目中引入了数千个依赖类,只是为了消除几十行简单的自定义代码。

使用库和框架是很好的。但成本总是存在的,掩盖成本的工具本身就是有问题的。

此外,有时(注意:当然不总是)通过编写一些小的类来实现您所需要的东西比引入对大型通用库的依赖更好。

其他回答

将单元测试作为验证代码的最后手段。

如果你想验证代码是正确的,我更喜欢以下技术而不是单元测试:

类型检查 断言 简单可验证的代码

对于其他一切,都有单元测试。

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

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

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

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

其中一个我已经琢磨了很久了:

数据就是系统。

流程和软件是为数据构建的,而不是相反。

没有数据,过程/软件就没有什么价值。没有流程或软件,数据仍然有价值。

一旦我们理解了数据,它是做什么的,它是如何相互作用的,它在不同阶段以不同的形式存在,只有这样才能构建一个解决方案来支持数据系统。

成功的软件/系统/过程似乎有一个敏锐的意识,如果不是狂热的正念,在任何给定的时刻数据在“哪里”。

在编程中使用的进程越多,代码就会变得越糟糕

I have noticed something in my 8 or so years of programming, and it seems ridiculous. It's that the only way to get quality is to employ quality developers, and remove as much process and formality from them as you can. Unit testing, coding standards, code/peer reviews, etc only reduce quality, not increase it. It sounds crazy, because the opposite should be true (more unit testing should lead to better code, great coding standards should lead to more readable code, code reviews should improve the quality of code) but it's not.

我认为这可以归结为我们称之为“软件工程”的事实,而实际上它是设计而不是工程。


以下数字可以证实这一说法:

From the Editor IEEE Software, November/December 2001 Quantifying Soft Factors by Steve McConnell ... Limited Importance of Process Maturity ... In comparing medium-size projects (100,000 lines of code), the one with the worst process will require 1.43 times as much effort as the one with the best process, all other things being equal. In other words, the maximum influence of process maturity on a project’s productivity is 1.43. ... ... What Clark doesn’t emphasize is that for a program of 100,000 lines of code, several human-oriented factors influence productivity more than process does. ... ... The seniority-oriented factors alone (AEXP, LTEX, PEXP) exert an influence of 3.02. The seven personnel-oriented factors collectively (ACAP, AEXP, LTEX, PCAP, PCON, PEXP, and SITE §) exert a staggering influence range of 25.8! This simple fact accounts for much of the reason that non-process-oriented organizations such as Microsoft, Amazon.com, and other entrepreneurial powerhouses can experience industry-leading productivity while seemingly shortchanging process. ... The Bottom Line ... It turns out that trading process sophistication for staff continuity, business domain experience, private offices, and other human-oriented factors is a sound economic tradeoff. Of course, the best organizations achieve high motivation and process sophistication at the same time, and that is the key challenge for any leading software organization.

请阅读文章,了解这些首字母缩写词的解释。