7

"There is a reason that we keep our variables private. We don’t want anyone else to depend on them. We want to keep the freedom to change their type or implementation on a whim or an impulse. Why, then, do so many programmers automatically add getters and setters to their objects, exposing their private variables as if they were public?"
-Uncle Bob, Clean Code.

Comments
  • 1
    That's data encapsulation which is part of oops where u can't change the property/behaviour defined in class as private of it but u can access it through getters !
Add Comment