Sometimes the most logical name for a class is already widely used in many libraries or is a word that is almost a reserved word like “Date”.  To avoid confusion, use a more unique name if possible so when it is referenced, there is no danger of it being confused with similar classes in Java or in library JAR files.

For example, many libraries and frameworks have a Config class.  It is tempting to name an application's configuration class the same, as follows:

Config config = new Config();

Instead, uniquify the classname.  

JukeboxConfig config = new JukeboxConfig();

Other examples where more uniqueness helped comprehension:

JukeboxException
JukeboxAction
JukeboxTimer
JukeboxMessage
JukeboxSessionListener
JukeboxUserProfile
JukeboxLogger
JukeboxTestCase
FileInfo
AuditDate

Exception: This method has a tendency to muddy data models that map directly to databases.  Whilst Customer is a common classname, it makes sense to keep it matching the table name.  

blog comments powered by Disqus