DCSIMG
Tip,Quality - Smallfish

Smallfish

Tips, Tricks, Shticks & Anything That Can Help You Be better Developer

Browse by Tags

All Tags » Tip » Quality (RSS)
Quality Code Short Tip #3 – Use Nested Class for Constants
One of the ‘best-practice’ and code styling guidelines say that you need to use constants instead of literals for more readability and ease of maintenance. Among the usages there are time that you want to specify database field names, xml attribute / element names and etc. In such cases the code easily get messed with dozens of constants around the code and make it harder to find the constant you need. A little trick can aid here: Instead of: 1: class TheClassUsingTheConstants 2: { 3: public const...