每天读一点,随手记下些东西,权当索引,懒得打字,直接从英文电子版复制了。页码对应中文第2版
P146 如果派生后覆写了某方法,但在其中没做任何事,应该参考以下内容
Be suspicious of classes that override a routine and do nothing inside the derived routine
…
The place to fix this problem is not in the base class, but in the original Cat class. Create a Claws class and contain that within the Cats class, or build a constructor for the class that includes whether the cat scratches. The root problem was the assumption that all cats scratch, so fix that problem at the source, rather than just bandaging it at the destination.
P149 关于使用继承还是包含的建议
If multiple classes share common data but not behavior, then create a common object that those classes can contain.
● If multiple classes share common behavior but not data, then derive them from a common base class that defines the common routines.
● If multiple classes share common data and behavior, then inherit from a common base class that defines the common data and routines.
● Inherit when you want the base class to control your interface; contain when you want to control your interface.
P170 逻辑上的内聚性
P171 好的子程序名字
P305 把枚举类型的第一个元素留做非法值
记下一些需要反复阅读的点
《代码大全》热门书评
-
堪称经典的力作
32有用 2无用 想飞的猫 2009-11-11
想要学习软件开发的都应该去读这本书。书里面有很多一般很难接触到的最佳实践的东西。很多时候,这些也就是新手和高手之间的区别。当你知道了很多这些东西之后,也就很难有人再去叫你菜鸟。我认为本书最值得去读的是中间那几章很详细的细节方面的描述,如变量命名之类。我也很讨厌死板的软件工程教条,但我不反对软件工程。...
-
软件构建的集大成者
25有用 2无用 草根程序员 2010-03-04
初见《代码大全》,还是该书的第一版,只从书名上看,还以为都是一些代码的示例。觉得还有很多的书需要读,这种实用主义的技巧书,可以先放一放,于是与之失之交臂。及至后来,才发现原来被中文书名给骗了。只要将目录浏览一过,就会发现,这本书基本覆盖了软件构建的全过程,从需要分析、系统架构设计到具体的编码规范、编...
-
代码大全中英文要点
22有用 3无用 rocedu 2006-09-19
《代码大全》是一本不多见的值得多次阅读的好书,在《代码大全》一书中,每一章后面都有这一章的要点,略读这些要点中我们就可以了解到我们已经掌握了哪些知识,哪些知识还没有掌握,阅读,重读时就有重点了。下面列出这些要点,供没有购买这本书的同学(同仁)参考,或可用作决定“是否应该买这本书”的参考。第1章 欢迎...
-
看过最好的计算机书籍之一
12有用 1无用 小疯叔 2008-10-24
对于编程来说,借鉴成功的经验很重要,而这本书是无论新手老手都一定要读一读的佳作。 讲的比较显浅易懂,而很多宝贵的经验一一道出,很多时候看着看着都会兴奋的叫出来。  ...
-
时机
11有用 0无用 忘川 2009-08-10
这本书看的还是满早了,所谓的早是指买回来基本没放,一个月时间读完。有人说书非借不能读也,我个人是非常赞同的,一般的书我都是买回来几个月才想起来看。 这本书的内容不想多谈了,任何夸奖的形容词用在该书上都不过份。但其实我看书的时候,书...