Welcome Guest, Not a member yet? Register   Sign In
defining constants in a config file?

(12-14-2015, 06:07 PM)ivantcholakov Wrote: If you intend to use constants widely as an alternative of the configuration options your system will loose the ability to change their values on the fly.
When would one ever want to change the values in a config file? Yes, you are certainly correct that constants cannot be changed during the execution of a script, but given the nature of these configuration files and the values they contain, I don't see this ever happening in practice. I.e., one will probably never need to change any of these types of values from their initial settings during script execution:
* file paths for log files and tmp directories
* email credentials
* database password, etc.

In my estimation, the biggest risk I run is that I might have some kind of name collision with some 3rd party library I might use. Or another risk is that other developers might consider the definition of these constants as unorthodox or confusing. Aside from these two risks, I see little else to be concerned about. Am I missing something?

Messages In This Thread
RE: defining constants in a config file? - by sneakyimp - 12-14-2015, 06:44 PM

Theme © iAndrew 2016 - Forum software by © MyBB