<qhelp>

<overview>

A magic number is a numeric literal (for example, `8080`, `2048`) that is used in the middle of a block of code without explanation. It is considered bad practice to use magic numbers because:

- A number in isolation can be difficult for other programmers to understand.
- It can be difficult to update the code if the requirements change. For example, if the magic number represents the number of guests allowed, adding one more guest means that you must change every occurrence of the magic number.

</overview> <recommendation>

Replace the magic number with the existing named constant. This overcomes the two problems with magic numbers:

- A named constant (such as `MAX_GUESTS`) is more easily understood by other programmers.
- Using the same named constant in many places makes the code much easier to update if the requirements change, because you have to update the number in only one place.

</recommendation> <example>

The following example shows a magic number `internal_port`. This should be replaced by the existing named constant, as shown in the fixed version.

</example> <references>

- R. C. Martin, Clean Code: A Handbook of Agile Software Craftsmanship, §17.G25. Prentice Hall, 2008.
</references> </qhelp>