Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not expose public setters on Aggregate root #10

Closed
humank opened this issue Jul 3, 2019 · 1 comment
Closed

Do not expose public setters on Aggregate root #10

humank opened this issue Jul 3, 2019 · 1 comment

Comments

@humank
Copy link
Owner

humank commented Jul 3, 2019

When doing the order create instruction, there are whole bunch of setters running there.
try to use a business-intention method to wrap up the creation detail, such as
Order purchased = Order.create(DTO);
rather than --->
Order purchaseOrder = new Order();
purchaseOrder.setDrinkHere(orderDTO.isDrinkHere());
purchaseOrder.setItemName(orderDTO.getItemName());
purchaseOrder.setPrice(orderDTO.getPrice());
purchaseOrder.setQuantity(orderDTO.getQuantity());
purchaseOrder.setSeatNo(orderDTO.getSeatNo());

@humank
Copy link
Owner Author

humank commented Jul 3, 2019

closed by commit 203b2dc

@humank humank closed this as completed Jul 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant