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

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

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

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


当前回答

如果以后可以节省3倍的时间,那就只写抽象。

有时我看到人们写出这些疯狂的抽象概念,我就会想:“为什么?”

除非抽象真的能在以后节省你的时间,或者它能节省维护你代码的人的时间,否则人们似乎只是越来越多地编写意大利面条式的代码。

其他回答

人们应该注释他们的代码?这似乎在这里很有争议。

代码只告诉我它实际做什么;这不是它应该做的

当我看到一个函数计算澳大利亚债券期货的点价值时,我想看到一些注释,表明编码器认为计算应该是什么!

Never make up your mind on an issue before thoroughly considering said issue. No programming standard EVER justifies approaching an issue in a poor manner. If the standard demands a class to be written, but after careful thought, you deem a static method to be more appropriate, always go with the static method. Your own discretion is always better than even the best forward thinking of whoever wrote the standard. Standards are great if you're working in a team, but rules are meant to be broken (in good taste, of course).

Web应用程序糟透了

我的网速很慢。我使用几乎所有不是谷歌的网站的经验至少是令人沮丧的。为什么现在没人写桌面应用了?哦,我明白了。没有人愿意学习操作系统是如何工作的。至少,不是Windows。上次你不得不处理WM_PAINT,你的头爆炸了。创建一个工作线程来执行一个长时间的任务(我的意思是,用Windows的方式来做)完全超出了你的能力。回调是什么鬼?哦,天哪!


垃圾收集糟透了

No, it actually doesn't. But it makes the programmers suck like nothing else. In college, the first language they taught us was Visual Basic (the original one). After that, there was another course where the teachers pretended they taught us C++. But the damage was done. Nobody actually knew how to use this esoteric keyword delete did. After testing our programs, we either got invalid address exceptions or memory leaks. Sometimes, we got both. Among the 1% of my faculty who can actually program, only one who can manage his memory by himself (at least, he pretends) and he's writing this rant. The rest write their programs in VB.NET, which, by definition, is a bad language.


动态类型糟糕透了

当然,除非您正在使用汇编程序(这是一种值得称赞的动态类型)。我的意思是动态解释性语言带来的开销让它们很糟糕。不要用不同的工具适合不同的工作这种愚蠢的论点。C语言是几乎所有事情的正确语言(它快速、强大、可移植),当它不是(它不够快)时,总有内联汇编。


我可能会提出更多的咆哮,但那将是以后,不是现在。

单身人士并不邪恶

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.

计算机科学或其他IT领域的学位确实会让你成为一个更全面的程序员

我不在乎你有多少年的工作经验,读过多少博客,参与过多少开源项目。一个资格证书(我建议超过3年)会让你接触到一种不同的思维方式,给你一个很好的基础。

仅仅因为你写了一些比计算机科学学士更好的代码,并不意味着你比他更好。你所拥有的,他可以在瞬间学会反之则不然。

拥有资格证书表明了你的承诺,你会超越经验,成为一名更好的开发人员。擅长自己的工作并且有资格的开发人员可能会非常令人生畏。

如果这个答案被否决,我也不会感到惊讶。

而且,一旦你有了资格,你就会慢慢停止和其他有资格的人比较(我的经验)。你意识到到最后一切都不重要了,只要你们能很好地合作。

始终仁慈地对待其他开发人员,无论其资格如何。