我正在对初级(也许是高级)软件工程师所犯的常见错误和错误假设进行一些研究。

你坚持时间最长、最终被纠正的假设是什么?

例如,我误解了整数的大小不是标准的,而是取决于语言和目标。说起来有点尴尬,但事实就是这样。

坦率地说;你有什么坚定的信念?你大概坚持了多长时间?它可以是关于一种算法、一种语言、一个编程概念、测试,或者任何关于编程、编程语言或计算机科学的东西。


当前回答

我仍然对以下的一些误解感到困扰——尽管我知道这些误解是正确的,但我仍然试图抓住它们不放:

All stakeholders will make decisions about software design objectively. Those that aren't embroiled in writing the code make all sorts of decisions based entirely on emotion that don't always make sense to us developers. Project budgets always make sense - I've seen companies that are quite happy to drop [just for example] $50,000 a month for years rather than pay $250,000 to have a project completed in 6 months. The government for one loses their annual budget if they don't spend it - so spend it they will, come hell or high water. It astounds me at how many project dollars are wasted on things like this. You should always use the right tools for the right job - sometimes this decision is not in your hands. Sometimes it comes down from on high that "thou shalt use X technology" for this project, leaving you thinking "WTF! Who came up with that ridiculous idea?"... the guy paying your paycheque, that's who, now get it done. Programming ideology comes first and foremost, everything else is secondary. In reality, deadlines and business objectives need to be met in order to get your paycheque. Sometimes you make the worst decisions because you just don't have time to do it the right way... just as sometimes that word is on the tip of your tongue but the minute it takes to recall it makes you choose a different and less ideal word. There isn't always time to do it right, sometimes there is only time to do it - however that may be. Hence oft' seen anti-patterns used by so called experienced developers who have to knock out a solution to a problem 10 minutes before the presentation deadline for the software being delivered to your best client tomorrow.

其他回答

不用分析我就能知道性能问题出在哪里

一个程序最终可以解决所有的问题。

我以为这将是一场过山车之旅,里面有飞驰的汽车、放荡的女人、私人飞机和大胆的冒险。等着瞧吧,直到我得到那个职业顾问....

在我刚开始学习c++的时候(很多时候),我周围都是Java学者。当被问及c++相对于Java的优势时(我通常会认为这是一个做作的问题,但就是这样),我会在我的回答中包括c++提供了引用和指针。Java的家伙会看起来难以置信,并建议引用是指针,并把我笑出了房间。我坚持在c++中引用和指针是不同的。

说句公道话,我是对的。引用和指针在语义和语法上是不同的。不幸的是,我用一个谬论来支持我的说法:底层实现是不同的。

我坚信,通过标准化,引用是语法中的名称别名,就像typedef是没有存储空间的类型别名一样。

我确信引用不是对象,也没有存储空间,它们只是提供了从“名称”到“对象”的多个顶级映射。在这方面,我认为它们就像文件系统中的软链接:

Code: int a = 3; int& b = a;

 Names          Objects           Memory

+-----+     +-------------+     +-------+
|  a  |---->|             |     |       |
+-----+     |             |     |       |
            |     int     |---->|   3   |
+-----+     |             |     |       |
|  b  |---->|             |     |       |
+-----+     +-------------+     +-------+

当然,尽管优化可能会导致这种情况,但引用确实有存储空间。它们是不同的对象,即使语法尽力将其从程序员那里抽象出来。

可以这么说,我很失望地了解到,关闭优化的编译器可能会将引用作为指针实现,需要一个解引用操作:我实际上是在文件系统中创建一个硬链接的类比:

Code: int a = 3; int& b = a;

 Names          Objects           Memory

+-----+     +-------------+     +-------+
|  a  |---->|     int     |---->|       |
+-----+     +-------------+     |       |
                                |   3   |
+-----+     +-------------+     |       |
|  b  |---->|     int&    |---->|       |
+-----+     +-------------+     +-------+

标准c++实际上并没有指定引用应该如何实现,所以我的理论可能适用于一些工具链,但在任何主流编译器中都不适用……当然标准中也没有说明。

我一直认为,任何为任何语言编写任何代码的人都会使用编辑程序。

I was working with a client of mine who had me on mostly as support and to write some of the more complex things for him. Well one day he messed up a file, big time. He accidentally saved over three hours worth of his own work, and when I asked him why he didn't save more often he replied with, "because I wasn't done". Naturally, this was not an acceptable answer, and I poked and prodded a little further. I eventually came to find out that he he has never used any editing program, EVER! Not even notepad.exe! He had been using an online CPanel editor for files! It didn't even have a 'Find' function. He couldn't ever save until he was done because he was editing the live file on the site!

不用说,我很惊讶,他至今仍在使用CPanel编辑器……