Showing posts with label best practice. Show all posts
Showing posts with label best practice. Show all posts

Java Variable Naming

I am not sure if this is the best practice for naming variables but I find the codes easier to read this way. Append the letter 'a' to every Class variables, 'p' to method/Constructor parameter, and 'l' to local variables .

If you do this I'm sure the guy who will maintain your code will not have a hard time debugging your code.

Class Animal {
private String aAnimalType;
public void setAnimalType(String pAnimalType){
aAnimalType = aAnimalType;
}
public String getAnimalType(){
return aAnimalType;
}
}

Posted at at Friday, July 17, 2009 on 7/17/09 by Posted by amj | 0 comments   | Filed under: , , ,