Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I don't know, these are mostly uninformed guesses, but the distinction between Records and Value objects is that the contents lack object identity.

Which, to me, means, potentially, two things.

One, that the JVM can de-dup "anything", like, in theory, it can with Strings now. VOs that are equal are the same, rather than relying on object identity.

But, also, two, it can copy the contents of the VO to consolidate them into a single unit.

Typically, Java Objects and records are blobs of pointers. Each field pointing to something else.

With Value Objects that may not be the case. Instead of acting as a collection of pointers, a VO with VOs in it may more be like a C struct containing structs itself -- a single, continuous block of memory.

So, an Object is a collection of pointers. A Record is a collection of immutable pointers. A Value Object is (may be) a cohesive, contiguous block of memory to represent its contents.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: