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

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

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

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


当前回答

c++是有史以来最糟糕的编程语言之一。

它具有委员会设计的所有特征——它不能很好地完成任何给定的工作,而且某些工作(如面向对象)做得很糟糕。它有一种“厨房水槽”的绝望,不会消失。

它是学习编程的可怕的“第一语言”。你(从语言中)得不到优雅,得不到帮助。取而代之的是陷阱和雷区(内存管理、模板等)。

它不是一种学习面向对象概念的好语言。它表现为“带有类包装器的C”,而不是一种合适的OO语言。

我可以继续讲下去,但现在就讲到这里。我从来不喜欢用c++编程,虽然我是在FORTRAN上“磨砺”的,但我完全喜欢用C编程。我仍然认为C是最伟大的“经典”语言之一。在我看来,c++肯定不是这样的。

欢呼,

-R

EDIT: To respond to the comments on teaching C++. You can teach C++ in two ways - either teaching it as C "on steroids" (start with variables, conditions, loops, etc), or teaching it as a pure "OO" language (start with classes, methods, etc). You can find teaching texts that use one or other of these approaches. I prefer the latter approach (OO first) as it does emphasize the capabilities of C++ as an OO language (which was the original design emphasis of C++). If you want to teach C++ "as C", then I think you should teach C, not C++.

但就我的经验而言,c++作为第一语言的问题在于,这门语言太大了,无法在一个学期内教授,而且大多数“介绍”文本试图涵盖所有内容。在“第一语言”课程中涵盖所有主题是不可能的。在我看来,你至少要把它分成两个学期,然后它就不再是“第一语言”了。

我确实教c++,但只是作为一种“新语言”——也就是说,你必须精通一些先前的“纯”语言(不是脚本或宏),然后才能注册这门课程。在我看来,c++是一种很好的“第二语言”。

-R

另一个编辑:(对康拉德)

I do not at all agree that C++ "is superior in every way" to C. I spent years coding C programs for microcontrollers and other embedded applications. The C compilers for these devices are highly optimized, often producing code as good as hand-coded assembler. When you move to C++, you gain a tremendous overhead imposed by the compiler in order to manage language features you may not use. In embedded applications, you gain little by adding classes and such, IMO. What you need is tight, clean code. You can write it in C++, but then you're really just writing C, and the C compilers are more optimized in these applications.

I wrote a MIDI engine, first in C, later in C++ (at the vendor's request) for an embedded controller (sound card). In the end, to meet the performance requirements (MIDI timings, etc) we had to revert to pure C for all of the core code. We were able to use C++ for the high-level code, and having classes was very sweet - but we needed C to get the performance at the lower level. The C code was an order of magnitude faster than the C++ code, but hand coded assembler was only slightly faster than the compiled C code. This was back in the early 1990s, just to place the events properly.

-R

其他回答

最好的程序员在调试器中跟踪所有代码并测试所有路径。

嗯…OP说有争议!

顾客并不总是对的。

在我处理的大多数情况下,客户是产品所有者,也就是“企业”。通常情况下,开发人员只是编写代码,而不试图在产品中提供既定的利益。人们有太多的误解,认为IT部门是“公司中的公司”,这完全是一堆垃圾。

I feel my role is that of helping the business express their ideas - with the mutual understanding that I take an interest in understanding the business so that I can provide the best experience possible. And that route implies that there will be times that the product owner asks for something that he/she feels is the next revolution in computing leaving someone to either agree with that fact, or explain the more likely reason of why no one does something a certain way. It is mutually beneficial, because the product owner understands the thought that goes into the product, and the development team understands that they do more than sling code.

这实际上已经开始引导我们走上提高生产力的道路。如何?由于双方的分歧已经改善了沟通,我们更有可能在过程中更早地走到一起,并就产品定义达成一个互利的解决方案。

记录器配置是浪费时间。如果这意味着学习一种新的语法,尤其是一种无声地失败的语法,为什么要有它们呢?不要误解我,我喜欢好的伐木。我喜欢日志记录器的继承和向日志记录器的处理程序添加格式化程序。但是为什么要在配置文件中进行呢?

您希望在不重新编译的情况下对日志代码进行更改吗?为什么?如果您将日志代码放在单独的类、文件中,会有什么不同呢?

您是否希望将可配置的日志与您的产品一起分发给客户端?这不是提供了太多信息吗?

最令人沮丧的是,用流行语言编写的流行实用程序往往会按照该语言指定的格式编写良好的api。编写一个Java日志实用程序,我知道您已经生成了javadocs,我知道如何导航。为您的日志记录器配置编写一种特定于域的语言,我们有什么?也许有文件,但到底哪里去了?你来决定怎么组织,我对你的思路不感兴趣。

理解“做什么”至少和知道“如何”做一样重要,而且总是比知道解决问题的“最佳”方法重要得多。领域特定的知识对于编写好的软件通常是至关重要的。

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

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

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

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

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

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

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