Application specific business rules vs Enterprise business rules

85 views
Skip to first unread message

Christian B

unread,
Oct 30, 2014, 8:37:53 AM10/30/14
to clean-code...@googlegroups.com
Given that we have a use case "RedeemVoucher" in a Checkout system.
Now the Webshop wants to redeem a voucher too.
Would i then put the "RedeemVoucher" interactor code in a Voucher entity which is shared code?
Because suddenly, a use case is used in more than one application.
I would have a use case implementation in an entity, and that feelds kind of wrong to me because we have interactors for this.

Łukasz Duda

unread,
Oct 30, 2014, 10:28:25 AM10/30/14
to clean-code...@googlegroups.com
Webshop could use checkout system to redeem voucher.
I would ask myself this question: Do I want all applications in enterprise to have the ability to redeem voucher?

Frederik Krautwald

unread,
Oct 31, 2014, 11:27:11 AM10/31/14
to clean-code...@googlegroups.com
Would i then put the "RedeemVoucher" interactor code in a Voucher entity which is shared code?

Definitely not! An Entity is a domain object, whereas an Interactor is an Application Service. If you find that code should be shared across different applications, factor it out into a shared kernel (e.g., a library).
Reply all
Reply to author
Forward
0 new messages