Closed bart-degreed closed 3 years ago
Although I try to keep those constants as close to the most likely source of that set of constants, it is not always possible. Also, when the constants are used in two different modules, I try to be conservative with practicing DRY and just duplicate them. Mapping the constants between the modules then becomes an explicit task of some kind mediator logic.
Makes sense, thanks.
I'm wondering if using a static class that solely contains constants (which are shared between multiple related classes) should be considered an exception to this rule.
For example:
I consider this preferable over magic strings or duplicating the constants in all types that use them. Or is there a better way to do this I haven't thought of?