We have an entity (class) containing data and methods (lets call it Person). There are other classes that need to use the data in this object (let’s call one of them Accountant), but do not need to use the functionality in it’s methods.
Would it be better to send the entire Person object to Accountant, or to create a new PersonData object just to hold the data and send that to the Accountant obj?
We do have one case we need to figure this out for, but I’d like to know the best general answer so we can utilize it throughout.
Generally, you would hand off a DTO where you need to consume the data in some serialized form – so over a web service or in a smart client for example. If you’re just using the Person object within the domain, and you have encapsulated properly, why go to the effort of creating a DTO?