You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I don't know if it is good practice, but for config classes such as ApplicationConfig, BrokerConfig etc... I normally tend to have the properties as public to avoid having to code getters.
The main reason is that, I as yourself, have set these properties as final, so client shouldn't be able to change the values. I understand that perhaps one of the properties may be a mutable list/map.
But could still could be convenient at a times.
The text was updated successfully, but these errors were encountered:
It probably does not matter in case of configuration files. I tend to use getter methods to adhere to OOP design and therefore avoid using public members wherever i can.
Just being curious, if you dont have getter methods then how are you accessing non static data members outside the class?
ye... but I don't know... I think it still adheres to oop designs if you cannot change the value (final). Also, java is so so verbose, having to create getters for lots of properties sometimes gets a bit ridiculous.
I don't know if it is good practice, but for config classes such as ApplicationConfig, BrokerConfig etc... I normally tend to have the properties as public to avoid having to code getters.
The main reason is that, I as yourself, have set these properties as final, so client shouldn't be able to change the values. I understand that perhaps one of the properties may be a mutable list/map.
But could still could be convenient at a times.
The text was updated successfully, but these errors were encountered: