OO设计的一些规则 - 摘自Head First Design Pattern(原)
1.Encapsulate what varies 2.Favor composition over inheritance3.Program to interface, not implementation4.Strive for loosely coupled design between objects that interact5.Depend on abstractions. Do not depend on concrete classes6.Only talk to you friends7.Don't call us, we'll call you8.A class should have only one reason to change-摘自Head First Design Patter 一本讲设计模式的好书,Jolt2006大奖的书,很值得读![@more@]OO设计的一些规则 - 摘自Head First Design Pattern
回车键的问题(原)
MS DOS/Windows 和unix中行尾回车键是不同的,在windows 中回车键返回的字符是CR/LF,2个bytes,对应的十六进制是"0D0A",而在unix中回车的返回字符是LF,1个字节,对应的十六进制是"0A"。在java中,为了使程序的可移植性,在生成文件时,我们可以通过在每一行的结尾加上System.getProperty("line.separator"),这样程序会根据不同平台使用不同的回车键返回字符。^-^ 不要小看这多余的一个byte,在商业的EDI中,数据传输是以byte来算钱的。[@more@]