|
|
|
|
|
by dkarl
3280 days ago
|
|
I don't like this example because I'm not sure what kind of realistic situation it's meant to represent. If config.Pi is really a config value, a value set at runtime by whatever configuration method is used by the application (environment variables, config service, whatever) then config.Pi is a very clear way to communicate that fact. If you want to communicate something more concrete in the code about how config.Pi is set and what its default value is, the right place for that information is where it's defined, not in every file where it's used. It's possible that the right thing to do is make pi a function parameter, but it wouldn't really change the readability of this file. It would change the readability of the code where Circumference is called, maybe for the better, maybe for the worse. |
|