I'm doing a code review for one project. It's architecture you can see on the following scheme:
At this moment DTO - are simple POJO's and Domains - contains Hibernate anotations. As I know one of the benefits using DTO is that you can make all domain fields as public and remove all that stub code with getters and setters. Is this correct approach?
What do you think about removing getters and setters from DTO's too? Also may be there are some pros implementing DTO's in Groovy?
What do think about that?
I would use JavaBeans because:
There are open-source helper classes that work with JavaBeans. e.g. Setting a property value whose name is unknown until the runtime.
There are times you need to do simple data transformation. Getters and setters can do that transparently.
You can check data "syntax". e.g. Throw a NullPointerException if a field should never be null.
Either way, do not mix public fields with JavaBeans. It'll confuse the heck out of everyone.