012 Magic numbers

Definition

From Wikipedia:

The term magic number also refers to the bad programming practice of using numbers directly in source code without explanation. In most cases this makes programs harder to read, understand, and maintain. Although most guides make an exception for the numbers zero and one, it is a good idea to define all other numbers in code as named constants.

Best practice

Never use magic numbers in Java code. Use descriptive constants instead.

See

http://en.wikipedia.org/wiki/Magic_number_%28programming%29

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.