Level 1: VO — value object
VO is the UI level object in a system. It used to display the UI object values.
Level 2: DTO — data transfer object
DTO, client side object that expose to outside.
Level 3: BO — business object
BO, perform business logic object and may contain one or more DO.
Level 4: DO — data object
Database object, the object in database.
Here provide an scenario of each object. Given a register user scenario, it contain ‘name, date of birth, sex, create date’ in table ‘customer’ and ‘location, city, country’ in ‘address’ table. These will be our DO object.
A BO may contain one or more DO object, it contain ‘name, age, date of birth, sex, location, city, country’, take a look over here. It have an extra field ‘age’ and the ‘created date’ removed. ‘age’ is something that shouldn’t store in database but it is meaningful in some business logic therefore it added and ‘created date’ used for data analysis ( calculate monthly user etc) it is meaningless in business logic hence it removed.
DTO, something we expose to outside world. ‘name, date of birth, sex, location, city, country’ will be the values of register user. User shouldn’t pass in the ‘age’ instead we can calculate it using the ‘date of birth’ in BO.
VO define what to display to user. ‘name, date of birth, sex, location, city, country’ is a must but it can have a different way to display. ‘handsome’ as male and ‘pretty’ as female in ‘sex’. Provide a drop down list in ‘country’ also make the VO object different with DTO.
I try to make this article short and simple. Hope this example scenario helps you understand the object architecture. Thanks for your time and claps. peace.