Good quality code uses very few string literals or unnamed numerical constants. Wikipedia does a great job of explaining why not to use magic values. I’ll summarise:
Magic values make code harder to read and understand.
Magic values are harder to alter.
Magic values are hard to peer review.
Magic values are hard to parameterise.
Magic values make typos easy.
Read the rest on the Optimal BI blog.
Leave a Reply