Wednesday, June 29, 2022

Java’s Encapsulation - When the Getter and Setter Became Your Enemy

Encapsulation is the key to a good code design, but how to archive it? Java developers automatically think about putting getter and setter in a private attribute. 

The encapsulation is a wrapping up of data under a single unit. It is the way to protect the data with OOP and avoid any security issues. The main idea around encapsulation is the data's guardian or a shield from being accessed by the code outside this shield when it makes sense. 



from DZone.com Feed https://ift.tt/70NFOCL

No comments:

Post a Comment