Women in Technology

Hear us Roar



Article:
  Wiring Your Web Application with Open Source Java
Subject:   Not a good template for building a domain layer
Date:   2004-04-13 12:31:34
From:   Groo
Response to: Not a good template for building a domain layer

Sorry, I didn't mean to imply a service layer is not a good thing. What I meant to say was that the business logic logic should be in the domain objects rather than in the service layer.


In a simple example such as this it may not be as obvious, but as you get a more complex domain model it becomes more apparent. For example, even something as trivial as polymorphism is hard to take advantage of without a proper domain model.

Main Topics Oldest First

Showing messages 1 through 1 of 1.

  • Not a good template for building a domain layer
    2004-04-27 09:29:50  thlee [View]

    IMHO the separation of domain model and business logic
    has became an inevitable trend in most business application
    development.

    The reason is that domain model often refers to conceptual/ER model, which is essentially
    the data/bean objects. Thus persistence is part of the requirement of the domain objects.
    While ideally POJO is preferred for domain objects (like Martin and other OO purist wished for),
    in most cases they have been converted to accomodate the persistent layer
    such as EJB or other O/R mapping tool due to the persistence requirement.
    To embed business logic inside the domain model implies that
    more (non-bean)APIs will be added to the domain model and persistent layer specific
    transaction-handling logic will need to be coded inside the domain objects
    which will make the domain model and implementation even uglier.

    Thus, separating the domain object from the business logic does have some advantages:
    1. Cleaner domain model and implementation
    2. Stability of domain model on changing/different implementations of business logic
    3. Separation of concern (bean persistence and business logic are separated)

    Just my 2 cents.

    BTW, nice article and comments.