Is it a good idea to "migrate business logic code into our domain model"?
Posted
by Bytecode Ninja
on Stack Overflow
See other posts from Stack Overflow
or by Bytecode Ninja
Published on 2010-04-08T02:33:42Z
Indexed on
2010/04/08
3:53 UTC
Read the original article
Hit count: 295
I am reading Hibernate in Action and the author suggests to move business logic into our domain models (p. 306). For instance, in the example presented by the book, we have three entities named Item
, Bid
, and User
and the author suggests to add a placeBid(User bidder, BigDecimal amount)
method to the Item
class.
Considering that usually we have a distinct layer for business logic (e.g. Manager
or Service
classes in Spring) that among other things control transactions, etc. is this really a good advice? Isn't it better not to add business logic methods to our entities?
Thanks in advance.
© Stack Overflow or respective owner