Tag: Magic Numbers

Some Refactoring Solutions For Magic Numbers

Some Refactoring Solutions For Magic Numbers

Today I’m looking at solutions to Magic Numbers. Magic numbers are hard coded numbers (or references) which appear in scripts and procedures, they creep in very easily. I don’t think that magic numbers are entirely bad. If you have a stored procedure which modifies data for a specific customer, having the one customer ID in…

Read More Read More

Replacing Repeated Magic Numbers

Replacing Repeated Magic Numbers

If an ID or reference is used more than once in a process, it’s best to store it in a variable and reference that. This can slow down debugging, but makes a process far more portable. It also reduces the number of magic numbers in a process (or at least times they are defined). I…

Read More Read More