Intro Class Object Method Naming
Intro Class Object Method Naming
Intro Class Object Method Naming
Intro
class & object 應該使用名詞或名詞片語來命名
ex:Customer、WikiPage、Account、AddressParser
在命名class時,應該避免命名為Manager、Processor
、Data、Info。class name也不應該是動詞。
method應該使用動詞或動詞片語來命名
ex:postPayment、deletePage、Save
根據javabean的標準,accessor應該使用get為字首
、mutators應該用set為字首、predicates應該用is
為字首。
String name = employee.getName();
customer.setName(“mike”);
if (payCheck.isPosted()) {