Why getters and setters are bad?

Getter and setter methods (also known as accessors) are dangerous for the same reason that public fields are dangerous: They provide external access to implementation details . What if you need to change the accessed field’s type? You also have to change the accessor’s return type.

Sizin İçin Seçtik  Which package includes all the standard classes of Java?

Leave a Reply

Your email address will not be published. Required fields are marked *