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

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

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

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


当前回答

Java将对象的副本传递给函数,而不是引用。

换句话说,我认为如果你将一个对象传递给一个方法,然后以某种方式改变对象,它不会改变调用范围内的对象。我总是将对象传递给方法,操作它们,然后返回它们!

其他回答

分析和性能分析是一回事。

然后我发现,虽然分析器总比没有强,但它包含错误的假设,比如:

只有总量才重要,细节无关紧要 统计精度是定位性能问题的必要条件 测量时间和定位不必要的耗时操作是一回事

规格是完整和充分的

我一直认为,要成为一名优秀的程序员,必须了解系统的所有内部工作原理。我很羞愧,因为在开始编码之前,我不知道关于这门语言的一切,比如它的库、模式、代码片段。 我不再那么天真了。

@Kyralessa: It's worth noting that on most processors, in assembly/machine language, it's possible for functions to return someplace other than their caller while leaving the stack in good condition. Indeed, there are a variety of situations where this can be useful. One variation I first saw on the 6502, though it works even better on the Z80, was a print-message routine where the text to be printed immediately followed the call instruction; execution would resume after the zero terminator (or, as a slight optimization when using the Z80, at the zero terminator, since letting the zero byte be executed as a NOP would be cheaper than trying to avoid it).

有趣的是,在许多现代语言中,函数都有一个正常的退出点(将在调用之后恢复执行),但也可以通过抛出异常退出。即使在C语言中,也可以使用setjmp/longjmp来模拟这种行为。

喂!,

我只是在设计和写代码。

没有需求收集、文档或支持。

欢呼,