Wherever possible, the names used in configuration files should match variable names used in the configuration class. Take the following XML configuration file for example:
<?xml version="1.0" encoding="UTF-8"?>
<myapp-config>
<showAdvancedFeatures>false</showAdvancedFeatures>
<validDomains>
<string>myapp.com.au</string>
<string>test.myapp.com.au</string>
</validDomains>
<validIpRanges>
<string>192.168.1.0:192.168.1.127</string>
<string>192.168.2.*</string>
</validIpRanges>
:
</myapp-config>
The model class that the values are loaded into has exactly the same names.
public class MyappConfig
{
private boolean showAdvancedFeatures = true;
private List<String> validDomains = new ArrayList<String>();
private List<String> validIpRanges = new ArrayList<String>();
:
}
To ensure related entities can be easily correlated by developers, the same rule applies everywhere.