Pattern: Global Name


Context

Ignoring classes, which are global variables by definition, you probably shouldn't add very many Global Variables during application development. However, when you do, it is helpful to be able to easily identify them by making use of a standard naming policy.

Solution

Make all global variable names begin with an uppercase letter. If the name has been derived from a phrase that contains more than one word, then use Word Capitalization to create the name.

You may consider prefixing all of your application global names with an identical short string that identifies the application. This will help to avoid name clashes if your application package is likely to be installed into another image where others have already made use of the same global names.

Consequences

Currently, with the lack of namespace support in the Smalltalk language, there is no real way around the issue of name clashes.Use of a common prefix will alleviate the problem but, almost inevitably, reduce the readability of client code that uses the globals..