我是专业发展的新手。我的意思是我只有 5 个月的专业发展经验。在此之前,我自己或在大学里研究过它。所以我在查看问题,发现这里有一个关于代码质量的问题。我自己也有一个与此相关的问题。如何提高我的代码理解/阅读能力?它还会提高我将编写的代码质量吗?有比匈牙利语更好的代码表示法吗?有没有关于 C++ 设计模式的真正好书(或者语言无关紧要?)? 提前感谢您回答这些问题并帮助我改进:)
附: - 另外我忘了告诉你我正在使用 C++ 和 C# 语言进行开发。
最佳答案
我发现只有一种方法可以更好地阅读其他人的代码,那就是阅读其他人的代码,当您发现您不理解的方法或语言结构时,请查找并使用它直到您理解为止这是怎么回事。
匈牙利符号很糟糕,今天很少有人使用它,它更像是程序员之间的一个笑话。
事实上,匈牙利符号这个名字本身就是一个笑话:
"The term Hungarian notation is memorable for many people because the strings of unpronounceable consonants vaguely resemble the consonant-rich orthography of some Eastern European languages."
来自 How To Write Unmaintainable Code
"Hungarian Notation is the tactical nuclear weapon of source code obfuscation techniques; use it! Due to the sheer volume of source code contaminated by this idiom nothing can kill a maintenance engineer faster than a well planned Hungarian Notation attack."
而广受欢迎的 linus 对此事有几句话要说。
"Encoding the type of a function into the name (so-called Hungarian notation) is brain damaged—the compiler knows the types anyway and can check those, and it only confuses the programmer."
编辑:
取自 Tobias Langner 的评论。
“有关 Apss Hungarian 和 Systems Hungarian 之间的差异,请参阅 Joel on Software”。
Joel on Software 提供了有关如何阅读他人代码的提示,称为 Reading Code is Like Reading the Talmud .
关于c++ - 如何毫不费力地阅读代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1206829/