Do immutable objects and DDD go together?

Posted by SnOrfus on Programmers See other posts from Programmers or by SnOrfus
Published on 2010-11-29T21:22:15Z Indexed on 2011/03/07 8:17 UTC
Read the original article Hit count: 416

Consider a system that uses DDD (as well: any system that uses an ORM). The point of any system realistically, in nearly every use case, will be to manipulate those domain objects. Otherwise there's no real effect or purpose.

Modifying an immutable object will cause it to generate a new record after the object is persisted which creates massive bloat in the datasource (unless you delete previous records after modifications).

I can see the benefit of using immutable objects, but in this sense, I can't ever see a useful case for using immutable objects. Is this wrong?

© Programmers or respective owner

Related posts about immutable

Related posts about domain-driven-design