Named constants

From CSSEMediaWiki
Revision as of 04:07, 4 October 2008 by Dominic Winkler (Talk | contribs)
Jump to: navigation, search

A Named Constant is a descriptive, meaningful, non literal name that is given to take the place of a number, string or other expression. It is similar to a variable, but cannot be modified. It has a global scope.

Named Constants should be used for values that occur in many places in the code. This allows you to easily change the value by changing the constant definition instead of changing the value in each place.

This improves the readability of the code, and makes it way easier to maintain.

Personal tools