OGeek|极客世界-中国程序员成长平台

标题: data access layer - What is DTO equivalent term for objects returned from DAL? [打印本页]

作者: 菜鸟教程小白    时间: 2022-6-22 20:04
标题: data access layer - What is DTO equivalent term for objects returned from DAL?

I'm already using DTO's for data transfer over a network. Now I'm also introducing different DTO-like classes to the DAL. This is to avoid passing the application (business) objects across layers.

To avoid naming confusion, I would like to use another term than DTO but can't find a good one.

What is DTO equivalent term for objects returned from DAL?



Best Answer-推荐答案


"What's in a name? that which we call a rose by any other name would smell as sweet." - William Shakespeare

Also, what Martin Fowler says about POJO:

In the talk we were pointing out the many benefits of encoding business logic into regular java objects rather than using Entity Beans. We wondered why people were so against using regular objects in their systems and concluded that it was because simple objects lacked a fancy name. So we gave them one, and it's caught on very nicely.

By the way, it does not matter that much. Looking at your concern to avoid confusion due to similar naming, you may choose from "DataModel", "Entity", "POCO".

Following are very loose considerations for different terms generally used:

Relational Model [Database Layer]:

Persistence Model [Data Access Layer]:

Domain Model/Business Model [Business Logic/Services Layer]:

View Model [UI Layer]:

DTO:

POCO:

Entity:

Model:

Refer following answers:

https://stackoverflow.com/a/37751345/5779732

https://stackoverflow.com/a/42801839/5779732






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://jike.in/) Powered by Discuz! X3.4