3 ms·
But many times the hard-coded values get used multiple times, have relationships between each other, it's unclear where they are in the code, etc. Keeping them
by crazygringo 11y ago
But many times the hard-coded values get used multiple times, have relationships between each other, it's unclear where they are in the code, etc.
Keeping them all at the top of the file (connectionTimeoutSeconds = 30, maxConnectionRetries = 3, maxSimultaneousConnections = 5, etc.) lets you clearly see, at a glance, what the current configuration is and how the options relate to each other, instead of having them scattered across the code nobody-knows-where.
You don't have to go all-out and create some separate monstrous configuration file nobody will understand. Just separate out hard-coded values in constant names at the top of each file, for a start.