Sunday, June 21, 2009

Reminder notes on some object types/

Just something I want to remember without having to do a web search.

DTO = data transfer object
VO = value object or transfer object.

Two main differences between DTOs and VOs.
First is mutability. DTOs are mutable property bags and VOs are immutable.

The second difference between DTOs and VOs is how equality is determined. DTOs are based on object identity and value objects are based on state. I think this means to say that if you override the Equals() on a DTO that computes on state data you have successfully converted a DTO into a VO. Another rephrase is that you must override the Equals() on a VO.


Got this from http://anirudhvyas.com/root/2008/04/19/abuses-of-dto-pattern-in-java-world/

No comments: