I have a small application with classic layers Controller-Service-Dao. Controller actually is REST resource, which deals with JSON data. And the questions are: 1. where is the best place to create business objects from JSON primitives? Controller or Service? Should controller pass primitives from JSON to service methods? 2. If objects should be created in controller layer is it good style to pass in service method primitive value in case it is some kind of search method by id?
UPDATE 1. I'm talking about java:
serviceSearchMethod(int value1, String value2);
vs
SomeObject someObject = new SomeObject(int value1, String value2);
serviceSearchMethod(someObject);
Of course, it can be that someObject
contains 10 fields, but controller has only 2 values, so is it good in this case create business object (BO) or it is suitable only in case I can create BO which is not just DTO to service layer, but something valuable from business point of view?