Bruno Marinho

Greenhorn
+ Follow
since Nov 05, 2009
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Bruno Marinho

thanks, but the question is more about where i can tranform request data to domain object (ddd) .. i can receive the entity from controller with spring or i create mappers class to do this, or i can create one form object?

about your response, i dont use "aplication services" i only use "domain service" that orchestrate the logic than i cant put in one entity or value object
6 years ago
This is a design question is the same problem in any language.

Guys as you do to map the controller to the domain model?

We have situations in general larger than ... consider the example objects .

situation.1 - We have a request that has all the parameters of the account ;
{ " id" : " 1 " , "name " : "test " , "some " : " xxx " } ............. and other fields .

situation.2 - can request that has to have a certain account parameters , for example in the case of an update;
{" id" , " 1" , "name " , " testUpdated "}

situation.3 - We have a request that has some parameters of the account , others have more like id as user together;
{ " id" : " 1 " , "user " : " xxx " , "service " : " yyy " } in which case each piece of the request will turn an object .



I see a few options ;

1 - Can I get AccountForm in the controller and set the properties for the Account object and others in CONTROLLER ;

+ ok for situation.1 situations 2, and situation.3
+ Separates the requisition of the object domain
- Pollutes the controller with code conversion
- Controller is full of setters .. if a higher class as a large object as a request is very confusing .



2 - Can I get AccountRequest in the controller and have a method in itself as AccountRequest.getAccount ( ) to return a mapped model , in this case the mapping is at own Request object .

+ Separates the requisition of the object domain
+ Encapsulates the conversion in a place with easy access .
+ Meets situation.1 situation.2 and situation3 ;
- Request object has two responsibilities represent the request and map to a valid model .


3 - Can I get the controller Direct Account which had been filled with nulls .

+ Eliminate object request
- Serves only situation.1 situation.2 .



4 - Outsource this mapping request parameters to another object mapper for request ..

+ Isolates logic mapping
- Until complexity for simpler cases are used as standard for all such a find by id .
- One more class for each request ;

In the case of API gets worse response has two further classes. speaking in terms of request for response .... AccountRequest, AccountRequestMapper, Account, AccountResponseMapper, AccountResponse ........

I'm doing more testing the Hybrid option 3 for simple cases (find ID or updates) .... with option 2 for example for more complex cases ...

What would be ideal / What is expressive and easy to maintain? Thank you.
6 years ago
it's true, there is some more "mock"for this exam?
hello guys

The Whizlabs has been updated to version 5 from what I saw looks like it.

Can anyone confirm this?

http://www.whizlabs.com/scdjws/scdjws-mock.html