2

Martin Fowler talks about the Domain Model where the Business Logic Layer contains classes that contain state and behaviour. As far as I am concerned this means:

1) Controller calls a class in the Business Layer, which returns a business object e.g. Car.  The business object is then casted to a ViewModel.
2) Business Logic Layer calls the repository, which returns a business object e.g. Car
3) Repository calls Data Layer (Entity Framework), which returns a data object e.g. car.

Where would you put methods that use multiple objects e.g. Order and Order Item? I would normally use a Service class for this (I am use to anemic Domain Models) with a TransactionScope. Is all Business Logic contained in the Domain Objects?

  • you can take a look to Apache ISIS project to see what look like rich domain model. – Walfrat Aug 3 '16 at 11:04
  • 3
    Beware, not all applications require rich domain models. I usually end up with anemic domain models and a service layer to coordinate between them since most of my projects don't contain complex business logic. I'm assuming your work is similar. First make sure your domain objects actually have enough complexity to benefit from the DDD approach. – Alternatex Aug 3 '16 at 11:59
  • See this question. – Kasey Speakman Aug 3 '16 at 17:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.