jira.codehaus.org

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What?s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
  • Mod4j: Modeling for Java using Domain Specific Languages
  • MODFORJ-118

Remove explicit update from business services

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Improvement Improvement
  • Status: Resolved Resolved
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: None
  • Fix Version/s: 2.0
  • Component/s: DSL for Business Domain, DSL for Services
  • Labels:
    None

Description

The DomainServiceImplBase classes explicitely call an update method on the DAO. However, since we use Hibernate this method is not implemented and could as well be left out. Then the update functions in the DomainServiceImplBase classes can also be removed.

To take this argument one step further; I consider these functions dangerous. They hinder a good OO design. Suppose I make an invoicing system. When I modify a (draft) Invoice, for example change an OrderLine, a lot might happen. Maybe some aggregates are calculated and the customer account is updated. This logic should be implemented in the domain model. But if the updates of the modified objects have to be persisted by the DomainService, how does that class know what happened? What if there is complicated conditional logic leading to state changes in the domain model? The domain service shouldn't care.

Issue Links

depends upon

Improvement - An improvement or enhancement to an existing feature or task. MODFORJ-102 Overcomplicated layering / DDD

  • Major - Major loss of function.
  • Resolved - A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.
relates to

Improvement - An improvement or enhancement to an existing feature or task. MODFORJ-114 Persisted objects within a Hibernate session do not need to be explicitly updated

  • Major - Major loss of function.
  • Resolved - A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • Work Log
  • History
  • Activity
Hide
Permalink
Pieter van Boxtel added a comment - 29/May/09 3:40 AM

Managing the persistence life-cycle of objects (creating and deleting them) should be possible from the domain model. When, how, under what conditions a (persisted) object should be created or removed is domain logic. Domain objects should be able to call life-cycle management methods on the DAO/Repository to achieve this.

Show
Pieter van Boxtel added a comment - 29/May/09 3:40 AM Managing the persistence life-cycle of objects (creating and deleting them) should be possible from the domain model. When, how, under what conditions a (persisted) object should be created or removed is domain logic. Domain objects should be able to call life-cycle management methods on the DAO/Repository to achieve this.
Hide
Permalink
Eric Jan Malotaux added a comment - 27/Apr/10 10:12 AM

Done.

Show
Eric Jan Malotaux added a comment - 27/Apr/10 10:12 AM Done.
Hide
Permalink
Eric Jan Malotaux added a comment - 28/May/10 6:35 AM

Still some work.

Show
Eric Jan Malotaux added a comment - 28/May/10 6:35 AM Still some work.

People

  • Assignee:
    Eric Jan Malotaux
    Reporter:
    Pieter van Boxtel
Vote (0)
Watch (0)

Dates

  • Created:
    29/May/09 3:29 AM
    Updated:
    28/May/10 10:01 AM
    Resolved:
    28/May/10 10:01 AM
  • Atlassian JIRA (v5.0.4#731-sha1:3aa7374)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Codehaus. Try JIRA - bug tracking software for your team.