To make a class as universally usable as possible, name it after its content, not its intended usage. After all, the usage might change, and you may find a new area of use for the class which you didn’t foresee.
In the project I’m working on, I had a class called
SelectedInstalledBase which represented the subset of products in a customer’s “installed base” selected by the user. (An “installed base” is this domain is all the products a customer has bought.)
That was fine until I wanted an inverted version of the selection, i.e. the installed base not selected (the “remaining installed base”). Then, it suddenly didn’t make much sense to create a remaining installed base of type
SelectedInstalledBase. It also didn’t make sense to create a clone of
RemainingInstalledBase as they would be identical apart from the name.
The solution the problem was renaming
InstalledBaseIdentifier (because it represented the ids of the selection made by the user) and naming the variables to reflect the different cases, such as
InstalledBaseIdentifier selectedInstalledBase and