So 2 questions:
- Should I use for my classes public or package access? In every project all my classes are kept in one package and I never use any methods from them in other projects. So do I need public access? I think package would be ok for me. And would be safer.
- I know habit of making fields private and making getters and setters for them. I also understand idea of hermetic, however everywhere I read about philosophy of making getters and setters I get only one reason: "You must do getters or setters so you are sure that one variable is not directly used in other part of program. Thanks to this you can be sure that you can make in such getter changes (like if statement which decides what value return) and be sure that every part will behave like that". But in 99.9% getters just return class private value. Almost every time getter have just 1 line "return XXX". So are there any other possiblites of using getters? And setters? I once deleted getters and setters from my project, made fields public and what I got was that my project got almost 30% smaller.