Pattern: Class Name


Context

When creating a New Class, a good class name will encourage others to re-use the class by illustrating its potential. In use, a well named class will also improve the readability of the code that makes use of it.

Solution

A class name must be a valid Global Name. It should reveal the purpose of the class to potential users. The name should not be too generic as to be meaningless, nor should it be too specific as to limit its reuse. The name does not need to describe implementation details of the class, as these should be private.

Known Uses

The CategoryManager class uses a dictionary for holding category information. The implementor has refrained from calling it CategoryDictionary because this is an implementation detail and could change in the future.

The Smalltalk Binary Filing mechanism consists of about twenty classes, and all of the class names begin with 'STB'. This reduces the risk of name collisions, and also logically groups the classes even though they are located in different parts of the class-hierarchy.