The best way to show that definitions are related is to group them together and then name them in a common way.

The following code snippet has three variables that appear unrelated:

public static final String FTP_MAX_TRIES_PROPERTY = "ftp.maxtries";
public static final String FTP_RETRY_DELAY_PROPERTY = "ftp.retrydelay";
public static final String DB_USER_PROPERTY = "db.user";

A simple adjustment to the naming convention clearly aligns them:

public static final String PROPERTY_DB_USER = "db.user";
public static final String PROPERTY_FTP_MAX_TRIES = "ftp.maxtries";
public static final String PROPERTY_FTP_RETRY_DELAY = "ftp.retrydelay";

They could even be sorted alphabetically if there are many definitions.

blog comments powered by Disqus