Yegor Bugayenko wrote:An object is NOT a data container.
What's wrong with data containers? Java (prior to Java 8) expects you to wrap pretty much everything in an object, so when you need to pass some data around you often end up with "data container" objects which are mostly/completely state rather than behaviour. More generally, one of the core problems with OOP is that it's based on subjective and sometimes disputed ideas of what constitutes an "object" and how they should interact, hence the need for lots of ad hoc
patterns (and anti-patterns) to help guide developers towards better implementations.
But I agree that getters/setters are a PITA e.g. when you have use Java Beans, even if you can auto-generate them where necessary via your
IDE. This is one place where languages like Groovy or Scala make life easier, because this stuff "just works" without a load of hand-coding or pointless boilerplate in your code. I'm starting to appreciate Scala's approach in particular i.e. properties are public and immutable by default but you can make them private/mutable if necessary (often it isn't). And Scala's case classes are a bit like Java Beans, but done properly!