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
using public fields in classes are bad practice. Is is very hard to use a class if every field and method is public, because everything is changeable and useable. We need a encapsulation of functions.
With Eclipse refactoring support, generation of getters and setter are possible. A good workflow is, change the field to private (without refactoing) and use quickfixes to use the getters/setters.
While refactoring please take some seconds and think about the fields and his visibility. Private is not the only way. We are implementing a framework which needs to be extends with overriding classes. Somethings there is a need for protected fields.
using public fields in classes are bad practice. Is is very hard to use a class if every field and method is public, because everything is changeable and useable. We need a encapsulation of functions.
With Eclipse refactoring support, generation of getters and setter are possible. A good workflow is, change the field to private (without refactoing) and use quickfixes to use the getters/setters.
While refactoring please take some seconds and think about the fields and his visibility. Private is not the only way. We are implementing a framework which needs to be extends with overriding classes. Somethings there is a need for protected fields.
see more info: https://docs.oracle.com/javase/tutorial/java/javaOO/accesscontrol.html
The text was updated successfully, but these errors were encountered: