Monday, August 09, 2010

Cleaner CDK Code #8: the Java Naming Conventions and Camel Casing

Another simple approach to make your code more readable, is to adhere to the Java naming conventions. They prescribe that variables start with a lower case characters, as do method
names. Class and interfaces, however, start with upper case characters. By all using these same conventions, we need to learn only one scheme and can more easily recognize what are variables, methods and classes. Have a look at these naming conventions by Oracle and the concept of Camel Casing, heavily used in Java.

BTW, note that the CDK conventions deviate from the Oracle conventions just linked to with respect to variable names. We have not found a way to have PMD to differentiate to where variables are used, and therefore require at least three characters per variable name, to enforce some meaningful naming, which is required by Oracle's conventions too.

Previous topics

No comments:

Post a Comment