Why is it not recommended to make all of a class's variables public?
You can then access the attribute only within the class itself, and by inheriting and parent classes.
You will have no control over which values the attribute can take. Any external code will be able to change it without any constraint.
The attribute may be accessed only by the class that defines the member.
Doing so makes your code tightly coupled.