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

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

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

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


当前回答

一个WTF总是一个糟糕专业的证据。

事实上,我最近才意识到在我的职业生涯中有多少WTF,但当StackOverflow告诉我它们只是另一个软件指标时,我感到欣慰。

其他回答

:

for (int i = 0; i < myObj.variable; i = i + 1)

优化为:

int j = myObj.variable; 
for (int i = 0; i < j; i = i + 1)

哇,当我意识到它们每次都在运行时,我停止在j的地方放入函数调用!

原因:

for (int i = 0; i < myObj.variable; i = i + 1){ 
    if (function_argument == NULL){ 
        myObj.variable++; 
    } else { 
        printf("%d", myObj.variable);
    }
}

并不等同于:

int j = myObj.variable;
for (int i = 0; i < j; i = i + 1){ 
    if (function_argument == NULL){ 
        myObj.variable++; 
    } else { 
        printf("%d", myObj.variable);
    }
}

任意的例子,但是您可以看到优化将如何改变执行。

我最近才发现在Hello World中执行了超过一百万条指令!我写的c++程序。我从来没有对像一条cout语句这样简单的东西有过如此高的期望

640K应该足够任何人(DOS)。多年来,很多人都相信这一点。

当我第一次拥有8MB内存的系统时,我认为这远远超过了我的需求。它可以运行操作系统(Mac)以及我使用的所有应用程序(Word、Email、Firefox等)。

没有bug的软件是可能的。

In the early days, most personal computers had a cassette tape interface for loading and storing programs. I did not have a computer at this time but read everything I could get my hands on (mostly magazines) that had anything to do with computers (this was the late 70's - no internet for me). For some reason I was under the impression that programs were executed directly from the cassette tape and that the only reason computers had any RAM was to store variables while the program ran. I figured that when the code had to execute a jump instruction, it would somehow rewind or advance the tape to the correct position and continue from there.