|
Named literals avoid the magic number anti-pattern. What does theseyou
statements mean:
if status_code = 32
return
endif
if acct_type = 32
...
endif
What the heck is 32? Are both 32's the same thing?
Compare to this
d EXIT_KEY_PRESSED C 32
d DEAD_BEAT C 32
...
if status_code = EXIT_KEY_PRESSED
return
endif
if acct_type = DEAD_BEAT
...
endif
Now the code is much clearer. And, if you want to locate code that
processes dead-beat accounts, it is ead to find. If you search for 32,
have to examine each reference and decide if it is account type or some
function key thing.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.