Backend Development 14 min read

Understanding VO, DTO, DO, and PO: Concepts, Differences, and Practical Applications

This article explains the definitions, distinctions, and practical usage scenarios of View Object (VO), Data Transfer Object (DTO), Domain Object (DO), and Persistent Object (PO) within a three‑tier architecture, offering guidance on when to combine or separate these layers.

Architecture Digest
Architecture Digest
Architecture Digest
Understanding VO, DTO, DO, and PO: Concepts, Differences, and Practical Applications

Concepts

VO (View Object): An object that encapsulates all data needed by a specific view or component on the presentation layer.

DTO (Data Transfer Object): An object used to transfer data between the presentation layer and the service layer, originating from J2EE design patterns.

DO (Domain Object): A business entity abstracted from the real world, representing domain concepts.

PO (Persistent Object): An object that maps one‑to‑one with the persistence layer (typically a relational database table).

Model

A simple sequence diagram illustrates how these objects interact across three layers: the user submits data that becomes a VO, the presentation layer converts the VO to a DTO for the service layer, the service layer creates a DO to execute business logic, the DO is transformed into a PO for persistence, and the reverse flow follows similar conversions when reading data.

VO vs DTO

Although VO and DTO often share the same attributes, they serve different design purposes: DTO represents the data contract between service and presentation layers, while VO represents the data needed for display. Keeping them separate maintains a clear separation of concerns, especially when different clients or UI styles require distinct representations.

When to Merge VO and DTO

If requirements are stable and there is only a single client, VO can be omitted and a single DTO used.

If client‑side scripts can handle the necessary transformations, VO may also be unnecessary.

When to Keep VO and DTO Separate

When multiple clients or customizable UI require different presentation logic.

When frameworks provide automatic POJO‑to‑UI field mapping, making a dedicated VO beneficial.

When a large view aggregates data from multiple services, separate DTOs may be needed before assembling a VO.

DTO vs DO

DTO is a flat data contract between presentation and service layers, while DO encapsulates business logic and may contain data not suitable for exposure. DOs often have methods, lazy‑loaded associations, and may not map one‑to‑one with DTOs.

DO vs PO

DOs and POs are usually one‑to‑one, but differences arise when persistence strategies or performance considerations lead to multiple PO‑to‑DO mappings or when certain PO fields (e.g., version for optimistic locking) have no business meaning.

Practical Guidance

Even if technical means allow merging concepts, designers should keep VO, DTO, DO, and PO distinct at the conceptual level to preserve clear architecture and avoid hidden coupling.

backendarchitectureDTOdesignDOPOVO
Architecture Digest
Written by

Architecture Digest

Focusing on Java backend development, covering application architecture from top-tier internet companies (high availability, high performance, high stability), big data, machine learning, Java architecture, and other popular fields.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.