Before we continue, this is NOT an argument for or against using global configuration. As some of us know, global state gets a really bad rap. Just ask around on Software Engineering Stack Exchange.
Global configurations are not state if you make them immutable, which is usually a sensible idea. From what I'm understanding I think what you might want to do is have a builder for the configuration but after the actual configuration is instantiated it is no longer mutable.
Immutable configurations are a popular solution too. But in this case, I needed a way to allow the global configuration change if need be, but it had to absolutely deliberate; not via "side-effects".
You usually can't have that with totally immutable objects; they tend to stay unchanged.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Global configurations are not state if you make them immutable, which is usually a sensible idea. From what I'm understanding I think what you might want to do is have a builder for the configuration but after the actual configuration is instantiated it is no longer mutable.
Thanks Jonathan,
Immutable configurations are a popular solution too. But in this case, I needed a way to allow the global configuration change if need be, but it had to absolutely deliberate; not via "side-effects".
You usually can't have that with totally immutable objects; they tend to stay unchanged.