On 2017-06-10 11:38 AM, Mark S Waterbury wrote:
...
The key phrase here, (and so, my "quote of the day") is, "Premature
optimization is the root of all evil." Hard-coding such symbolic values
in programs is just another form of "premature optimization." (It's a
"Pay now, or pay later" kind of thing...)
That "premature optimization" quote is one of my faves! It's one of the
quotes listed on my work home-page.
But I don't agree that hard-coding symbolic values counts as premature
optimization. I don't actually even understand the statement enough to
argue against it. Using named constants just seems like obvious goodness
to me.
Ohhhh, following the policy of "think before clicking send" ... Are you
saying that it would be better to use a database to store all the values
that we currently use named constants for?
I guess that could make sense for some "constants", but it could lead to
serious hoop-jumping in some cases, such as using constants for
definitions. And if overused, it could lead to one of the 3% of
performance issues that do need to be dealt with.
And I think it would only count as premature optimization if there was
already a system or policy in place to get "constants" from a central
place like a database or srvpgm, and a programmer decided to just go
with a named constant.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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
copyright@midrange.com.
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.