Recently there was a big debate during a code reveiw session on the use of constants. The developers had used constants for the following purposes:
- Each and every message key used in the i18N application was declared as a constant. The application contained around 3000 message keys and hence the same number of constants.
- Each and every database column name was declared as a constant. There were around 5000 column names and still counting..
Does it make sense to have such a huge number of constants in any application? IMHO, common sense should prevail. Message keys just don't need to be declared as constants. We already have one level of indirection - why add one more?
Reg. database column names, I have mixed opinions. If a column is being used in multiple classes, does it make sense to declare it as a global constant?
Please pour in with your thoughts...