I have two layers:
- API: exposes the different resources and objects for consumers. (jar)
- Service : contains all the business logic.
I have objects, constants and enums that I am repeating them since I use them in both layers
So, in the API i can have one object like
class MyObject {
MyEnum enum;
...
//getters and setters
}
and
enum MyEnum {
ONE, TWO
}
In my service layer i have my MyObjectDTO (with some business variables that are exclusive to the service layer) and the same MyEnum.
I have repeated objects in both layers (with some differences but not at the enums or constants).
The question is: Is there a better approach?
Thanks in advance!
Aucun commentaire:
Enregistrer un commentaire