Anemic Domain Model and SOA
|
|
Martin Fowler describes an Anti-Pattern christened the "Anemic Domain Model". He argues that the service layer remain thin and a behaviorally rich domain layer. His arguments are in sync with conventional Object Oriented practices. Interestingly enough he speculates that EJBs seem to encourage this Anti-Pattern. In his conclusion, Martin Fowler offers the following stark commentary:
In general, the more behavior you find in the services, the more likely you are to be robbing yourself of the benefits of a domain model. If all your logic is in services, you've robbed yourself blind.
How is this Anti-Pattern encouraged by Service Oriented Architectures (SOA)? Is Martin Fowler's Service Layer correspond directly to the Services in SOA or are we describing a completely different animal? My hunch is that the correlation is accurate, which leads me to a somber conclusion. Nobody has really created a compelling demonstration of reusability using SOA. So until that happens, SOA for all intents and purposes in an Anti-Pattern from the perspective of OO purists.
On the other hand, Generic Programming, that is the style that you find in C++'s STL, shares similar non-OO characteristics. Also, the OFBiz folks have argued for a similar kind of design. That's two examples where behavior outside domain objects seem pragmatically effective.

