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

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

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

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


当前回答

过程式编程很有趣。OOP很无聊。

其他回答

生成文档良好的代码比生成文档不良的代码花费的时间更少

When I say well-documented I mean with comments that communicate your intention clearly at every step. Yes, typing comments takes some time. And yes, your coworkers should all be smart enough to figure out what you intended just by reading your descriptive function and variable names and spelunking their way through all your executable statements. But it takes more of their time to do it than if you had just explained your intentions, and clear documentation is especially helpful when the logic of the code turns out to be wrong. Not that your code would ever be wrong...

I firmly believe that if you time it from when you start a project to when you ship a defect-free product, writing well-documented code takes less time. For one thing, having to explain clearly what you're doing forces you to think it through clearly, and if you can't write a clear, concise explanation of what your code is accomplishing then it's probably not designed well. And for another purely selfish reason, well-documented and well-structured code is far easier to dump onto someone else to maintain - thus freeing the original author to go create the next big thing. I rarely if ever have to stop what I'm doing to explain how my code was meant to work because it's blatantly obvious to anyone who can read English (even if they can't read C/C++/C# etc.). And one more reason is, frankly, my memory just isn't that good! I can't recall what I had for breakfast yesterday, much less what I was thinking when I wrote code a month or a year ago. Perhaps your memory is far better than mine, but because I document my intentions I can quickly pick up wherever I left off and make changes without having to first figure out what I was thinking when I wrote it.

这就是为什么我能很好地编写文档——不是因为我觉得编写适合展示的漂亮代码是一种崇高的使命,也不是因为我是一个纯粹主义者,而只是因为端到端让我在更短的时间内发布高质量的软件。

C(或c++)应该是第一种编程语言

第一语言不应该是简单的,它应该是建立学生的思想,为严肃的计算机科学做准备的语言。 C语言是完美的,它迫使学生考虑内存和所有低级别的东西,同时他们可以学习如何构造代码(它有函数!)

c++有一个额外的优势,它真的很糟糕:)这样学生就会明白为什么人们必须想出Java和c#

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语言是几乎所有事情的正确语言(它快速、强大、可移植),当它不是(它不够快)时,总有内联汇编。


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

软件开发只是一份工作

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

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

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

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

全局变量和/或单例变量本身并不邪恶

我来自更多的系统管理员,shell, Perl(和我的“真正的”编程),PHP类型的背景;去年我被派去做Java开发工作。

单身是邪恶的。全球人太邪恶了,他们甚至不被允许。然而,Java有像AOP这样的东西,现在还有各种“依赖注入”框架(我们使用谷歌Guice)。AOP就不是这样了,但是DI的东西肯定会给你什么?全局变量。啊,谢谢。