A way of thinking about writing a good piece of code is to remember that not everything out there is good. Not all language features will help you write quality code. Some features may in fact be considered harmful (a code smell) and are hence discouraged.
Let’s consider the case of getters and setters. They are common in most languages. You might say what’s wrong about getters and setters? Well everything!
Getters and setters break the very concept of encapsulation and data abstraction. They essentially give access to the internal implementations which should never happen in any good OO design. Only place where you might think of using getters is comparison between same type of objects.