#348 Data Transfer Object design pattern#608
Conversation
…attern simple version.
… details to server at one shot.
iluwatar
left a comment
There was a problem hiding this comment.
The project file for the class diagram is missing (.ucls)
| <packaging>pom</packaging> | ||
| <modules> | ||
| <module>../data-transfer-object</module> | ||
| </modules> |
There was a problem hiding this comment.
Why is Data Bus pattern affected? Should this change be reverted?
| customers.add(customerOne); | ||
| customers.add(customerTwo); | ||
|
|
||
| CustomerResource customerResource = new CustomerResource(customers); |
There was a problem hiding this comment.
This is customer server data initialization, right? Could we move to static block in CustomerResource class?
There was a problem hiding this comment.
@iluwatar Yes, we can. But the unit tests for the CustomerResource class will not be pure. As the class itself is having some initial data. Don't you think the unit tests will be more confusing one?
| } | ||
|
|
||
| private static void printCustomerDetails(List<CustomerDto> allCustomers) { | ||
| allCustomers.forEach(customer -> System.out.println(customer.getFirstName())); |
There was a problem hiding this comment.
Don't use System.println, instead add and use a logger as in other examples.
There was a problem hiding this comment.
@iluwatar 👍 Ok. Make sense. Did the same.
Thanks.
| public class CustomerDto { | ||
| private String id; | ||
| private String firstName; | ||
| private String lastName; |
There was a problem hiding this comment.
This looks like immutable class. The private members should be declared final.
This reverts commit db10b93.
…immutalbe model.
|
@iluwatar : Added missing class diagram. Thanks. |
|
@gopinath-langote looks good now. Thanks for the contribution! 👍 |
Basic version of Data transfer object pattern implementation.