Code Monkey home page Code Monkey logo

Comments (5)

tsobe avatar tsobe commented on September 27, 2024 2

Thanks for the reply!

So basically identity is enforced by ORM and not the domain, right? I understand that it gives convenience to configure ORM to handle mapping between domain and persistence entities without writing translation code manually, but does not it leak abstraction? I say leaky abstraction cause, ID is not used on Value Objects in terms of business and there can exist different repository implementation which can store and retrieve collection of value objects without enforcing them to have identity. I understand that we might "say no to perfect code" sometimes in favour of some another benefit (like convenience in this case) and I don't see any problem as long as team respects Value Object semantics and does not access them directly via ID, but is not possible to improve this somehow? Or is it a thing I should really worry about?

from iddd_samples.

VaughnVernon avatar VaughnVernon commented on September 27, 2024

It's for special cases of Value Objects that must be persisted through an
ORM as entities in the database. One example is a collection of Values.

On Aug 28, 2016 8:13 AM, "Beka Tsotsoria" [email protected] wrote:

Can anyone explain why IdentifiedValueObject
https://github.com/VaughnVernon/IDDD_Samples/blob/master/iddd_common/src/main/java/com/saasovation/common/domain/model/IdentifiedValueObject.java
has identity? Does not it violate definition of Value Object? Is it domain
identity or persistence identity?


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#22, or mute the
thread
https://github.com/notifications/unsubscribe-auth/ACg87MQU0FO98aEeXMBIT6Ksjvu_mIA9ks5qkZd1gaJpZM4Ju7uf
.

from iddd_samples.

VaughnVernon avatar VaughnVernon commented on September 27, 2024

It's one way to solve the particular problem, a way that is discussed in my
IDDD book. There are other ways as well.

On Aug 29, 2016 3:04 PM, "Beka Tsotsoria" [email protected] wrote:

Thanks for the reply!

So basically identity is enforced by ORM and not the domain, right? I
understand that it gives convenience to configure ORM to handle mapping
between domain and persistence entities without writing translation code
manually, but does not it leak abstraction? I say leaky abstraction cause,
ID is not used on Value Objects in terms of business and there can exist
different repository implementation which can store and retrieve collection
of value objects without enforcing them to have identity. I understand that
we might "say no to perfect code" sometimes in favour of some another
benefit (like convenience in this case) and I don't see any problem as long
as team respects Value Object semantics and does not access them directly
via ID, but is not possible to improve this somehow? Or is it a thing I
should really worry about?


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#22 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ACg87KmWjjx_knQQWXcFnTvneiewUEZZks5qk1dfgaJpZM4Ju7uf
.

from iddd_samples.

tsobe avatar tsobe commented on September 27, 2024

After little googling I came across to an idea where one suggests to extend subclasses of IdentifiedValueObject like GroupMember at the persistence layer and declare ID (and potentially other persistence related fields) on this extended object, this way IdentifiedValueObject will not be needed anymore and domain layer will be free from the persistence concerns.

I'll definitely read IDDD sooner or a later!

from iddd_samples.

itsmoonrack avatar itsmoonrack commented on September 27, 2024

@sevteen I was thinking the same whereas actually by declaring ID in the extended object directly, you just added persistence data in your domain. By using the IdentifiedValueObject, you don't explicitely have to add this knowledge. Moreover the id being private in the super class, you never come accross as a developper in your child OneToMany value object.

from iddd_samples.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.