I have two sets of classes in my spring application - DTOs and Entities.
After reading Clean Code by Uncle Bob, I have got hooked on to naming things right more than ever before.
I sat down refactoring one of my Spring projects and I am not sure if adding DTO suffix for DTO classes is the right thing to do. If not, then how do you differentiate between DTO and Entity classes. I do use Service and Repository suffixes for my service classes and repository interfaces.
Merely keeping them under different packages with same names is not helpful esp. when they are to be used in same scope.
Note: Not sure if this is a precise question to be asked on Stackoverflow.
If you read Core J2EE Patterns, 2nd Edition, it is called Transfer Object with all the sample codes having the TO
suffix. You can also have a look at Oracle's Core J2EE Patterns site.
To sum up: You should use either DTO
or TO
as a suffix to any transfer object you use in your business tier.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With