SSW Foursquare

Use Enum Constants instead of Magic numbers?

Last updated by Ben Neoh [SSW] 10 months ago.See history

Using "Magic numbers" in your code makes it confusing and really hard to maintain.

MagicNumberBad
Figure: Bad example - "Magic Number" works, but is a bad idea

enumClass
Figure: Good example - Add Enum

MagicNumberGood
Figure: Good example - No Magic Number, looks good and is easy to manage

Adam Cogan
We open source.Loving SSW Rules? Star us on GitHub. Star
Stand by... we're migrating this site to TinaCMS