Data transfer object (DTO), is a design pattern used to transfer data between software application subsystems. DTOs are often used in conjunction with data access objects to retrieve data from a database.
The difference between data transfer objects and business objects or data access objects is that a DTO does not have any behavior except for storage and retrieval of its own data (accessors and mutators). DTOs are simple objects that should not contain any business logic that would require testing.
In a traditional EJB (Enterprise JavaBeans) architecture, DTOs serve dual purposes: first, they work around the problem that entity beans pre-ejb 3.0 are not serializable; second, they implicitly define an assembly phase where all data to be used by the view are fetched and marshalled into the DTOs before returning control to the presentation tier. A third reason of using DTOs could be that certain layers of the application should not be able to access the underlying data access objects, and hence change the data.
Famous quotes containing the words data, transfer and/or object:
“To write it, it took three months; to conceive it three minutes; to collect the data in itall my life.”
—F. Scott Fitzgerald (18961940)
“I have proceeded ... to prevent the lapse from ... the point of blending between wakefulness and sleep.... Not ... that I can render the point more than a pointbut that I can startle myself ... into wakefulnessand thus transfer the point ... into the realm of Memoryconvey its impressions,... to a situation where ... I can survey them with the eye of analysis.”
—Edgar Allan Poe (18091849)
“It is the nature of our desires to be boundless, and many live only to gratify them. But for this purpose the first object is, not so much to establish an equality of fortune, as to prevent those who are of a good disposition from desiring more than their own, and those who are of a bad one from being able to acquire it; and this may be done if they are kept in an inferior station, and not exposed to injustice.”
—Aristotle (384322 B.C.)