Skip to content

Latest commit

 

History

History
32 lines (21 loc) · 646 Bytes

MagicNumber.md

File metadata and controls

32 lines (21 loc) · 646 Bytes

Magic numbers (MagicNumber)

Description

Magic numbers are any number in your code that does not immediately become apparent without being immersed in context.

Examples

Bad

Function GetsTheInterval(Duration)

     Return Duration < 10 * 60 * 60;

End Function

Good

Function GetsTheInterval (Duration in Seconds)

    MinutesHour     = 60;
    SecondsMinute   = 60;
    SecondsHour     = SecondsMinute * MinutesHour;
    HoursIninterval = 10;
    Return Duration < HoursWininterval * SecondsHour;

End Function