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

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

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

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


当前回答

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.

其他回答

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

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

OOP已经过时了:(直到今天我仍然后悔这么想。

My co-workers were/are producing supposedly bad code because they sucked/suck. It took me a while to learn that I should first check what really happened. Most of the times, bad code was caused by lack of management, customers who didn't want to check what they really wanted and started changing their minds like there's no tomorrow, or other circunstances out of anyone's control, like economic crysis. Customers demand "for yesterday" features because they are stupid: Not really. It's about communication. If someone tells them it everything can really be done in 1 week, guess what? they'll want it in 1 week. "Never change code that works". This is not a good thing IMO. You obviously don't have to change what's really working. However, if you never change a piece of code because it's supposedly working and it's too complex to change, you may end up finding out that code isn't really doing what it's supposed to do. Eg: I've seen a sales commission calculation software doing wrong calculations for two years because nobody wanted to maintain the software. Nobody at sales knew about it. The formula was so complex they didn't really know how to check the numbers.

面向对象始终是设计源代码的最佳方式,而且永远都是。

我需要定义所有的变量,我将使用在我的函数在其开始(Pascal风格)。

我曾经相信我需要考虑我的函数使用的所有资源,并在我开始编码之前定义它们,这可能是因为我的第一门语言是Pascal,这是要求。然后当我转移到C语言时,我会定义只在这些循环之外的循环中使用的临时变量,忽略循环内作用域,只是为了“一切都将在开始时定义”。

我花了几年时间才明白,提前定义所有资源并不是一件容易的事,而且范围本身对代码可读性非常重要。