Hacker News new | ask | show | jobs
by vonmoltke 4083 days ago
I'm not following what you think you are avoiding and how you think you are avoiding it. For example, I used to work on radar signal processing code. We had several global constants that were used in various calculations in the processing pipeline, one of which was the speed of light at various altitudes. Regardless of the manner in which these constants were inserted into the program, changing one of them was going to have direct effects on several calculations and ripple effects on others. It is just the nature of radar equations.

Thus, if you have a program that has an immutable global constant it is likely in the same situation. How do you ever change that value in any way without retesting everything to see what the effect was?

1 comments

Thus, if you have a program that has an immutable global constant it is likely in the same situation.

I don't accept your premise.

Firstly, constants are used for all kinds of things, from hard mathematical data as in your example to configuring connectivity with external services via particular database details or URLs.

Secondly, while some programs really do only have one main purpose and so some of the background/context data really is almost globally applicable, this is certainly not always the case. In particular, the larger a software system becomes, the less likely this is to be true.

How do you ever change that value in any way without retesting everything to see what the effect was?

If the value doesn't have global scope, you don't have to retest everything, only parts of the system that can be affected by the change.