2007年9月13日 星期四

java 命名規則

大家都知道,java 的命名是有規範的,雖然不依照規則命名還是可以跑。但是依據一個法則,閱讀起來也比較方便。可以參考以下網站
Code Conventions for the JavaTM Programming Language

比如說 package 的命名:

規範是"小寫" and "should be one of the top-level domain names, currently com, edu, gov, mil, net, org, or one of the English two-letter codes identifying countries as specified in ISO Standard 3166, 1981."
就是說要用 com , edu... , 或是國家如: tw 來開頭 。

而且接者的名稱會根據'公司名'或是'部門名'或是'專案名'...來命名

例如:com.sun.eng , edu.cmu.cs.bovik.cheese.....


會提到 package 是因為看到下面文章:

Managing the Java classpath

覺得有太多沒注意到的地方要注意。