java DTO、DAO 和 DCO。什么是 DCO?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/759708/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
DTO, DAO, and DCO. What is a DCO?
提问by Peter Perhá?
My search for the meaning of DCO was quite fruitless, so I decided to ask here. In my Java application, there are many classes like EmployeeDetailsDto, EmployeeDetailsDao, but recently I also came across EmployeeDetailsDco. Does anyone know what does the DCO stand for?
我对DCO含义的搜索很没有结果,所以我决定在这里问。在我的 Java 应用程序中,有很多类,例如 EmployeeDetailsDto、EmployeeDetailsDao,但最近我也遇到了 EmployeeDetailsDco。有谁知道DCO代表什么?
采纳答案by Peter Perhá?
I just spoke to the guy who used to remember what this stands for. It's pretty ironic that he no longer does. Nor do any other people here in this company.
我刚刚和那个曾经记得这代表什么的人交谈过。具有讽刺意味的是,他不再这样做了。这家公司的其他人也没有。
The explanation I could find was, that it's basically a DTO, but they wanted to use DCO to differentiate between DTOs used by Hibernate and DCOs used by external systems, in this case LDAP.
我能找到的解释是,它基本上是一个 DTO,但他们想使用 DCO 来区分 Hibernate 使用的 DTO 和外部系统使用的 DCO,在这种情况下是 LDAP。
So I believe the meaning of DCO could really be, as Bhushan suggests, Data Carrying object or the like, and in this case it was indeed intended to be just another name for DTO. Answer accepted. Thanks for your time! I thought DCO was an accepted acronym widely used by developers but it turned out to be just this... sorry.
所以我相信 DCO 的含义真的可以像 Bhushan 所暗示的那样,数据携带对象或类似的东西,在这种情况下,它确实只是 DTO 的另一个名称。答案已接受。谢谢你的时间!我以为 DCO 是开发人员广泛使用的公认首字母缩略词,但结果却是这样……抱歉。
Edit
编辑
THE answer is Data Container Object, for those interested. I have caused enough stir in the company so eventually a colleague emailed the local originator of the DCO term and, if anyone still cares to find out, it stands for Data Container Object.
对于那些感兴趣的人,答案是数据容器对象。我在公司引起了足够的轰动,因此最终一位同事通过电子邮件向 DCO 术语的本地发起人发送了电子邮件,如果有人仍然想知道,它代表数据容器对象。
回答by Russ Cam
DTO = Data Transfer Object
DAO = Data Access Object
DTO =数据传输对象
DAO =数据访问对象
DCO = 动态可配置对象?
From the article
从文章
Dynamically configurable object (DCO)
动态可配置对象 (DCO)
an object whose implementation can change incrementally after it is running
一个对象,它的实现在运行后可以增量改变
- consists of interface elements
- public function
- private function
- private data along with all accessor functions
- member functions support incremental changes to interface elements
- adding, removing, or altering
- 由界面元素组成
- 公共职能
- 私人功能
- 私有数据以及所有访问器功能
- 成员函数支持对界面元素进行增量更改
- 添加、删除或更改
回答by Robert Gould
All I can say is Data Carrying Object is not what DCO means, put "Data Carrying Object" in google and it doesn't return any hits.
我只能说数据携带对象不是 DCO 的意思,将“数据携带对象”放在谷歌中,它不会返回任何命中。
Thus the terms has to be wrong.
因此,条款必须是错误的。
Ok tried googling "Data Objects DCO"
好的尝试谷歌搜索“数据对象 DCO”
and got this result, which would suggest DCO means "Data Change Objects"
并得到了这个结果,这表明 DCO 的意思是“数据更改对象”
My guess is a DCO is an object that holds changes, a "diff", of the Object's Data.
我的猜测是 DCO 是一个保存对象数据变化的对象,一个“差异”。
回答by mP.
Refactor the Dtos and drop the DTO suffix.
重构 Dtos 并删除 DTO 后缀。
You might want to change Dao to Store or something similar.
您可能希望将 Dao 更改为 Store 或类似的内容。
Firstly EmployeeSetails without Dto/dco on the end obviously is a value class holding values relating to an employee. Without another term it's obvious it's not a utility - which should be called something g like EmployeeDetailsUtil/Helper etc.
首先,最后没有 Dto/dco 的 EmployeeSetails 显然是一个持有与员工相关的价值观的价值类。如果没有另一个术语,很明显它不是一个实用程序——它应该被称为 EmployeeDetailsUtil/Helper 等。
Your dao should be called EmployeeSetailsStore because that describes it's function a store of EmployeeSetsils. How or where it puts them is irrelevant they are hidden away in your code. If you really wanted to you could call it HibernateEmploteeDetaileStore etc if it used Hibernate. Your interface should be called EmployeeSetailsStore. Implementors or this interface would use the interface name as a start and add impl technology to that base name.
你的 dao 应该被称为 EmployeeSetailsStore 因为它描述了它的功能是一个 EmployeeSetsils 存储。它们如何或放置在何处与它们隐藏在您的代码中无关。如果你真的想要你可以称它为 HibernateEmploteeDetaileStore 等,如果它使用 Hibernate。您的界面应称为 EmployeeSetailsStore。实现者或此接口将使用接口名称作为开始,并将 impl 技术添加到该基本名称。
Last but not least String is a value here of a char array but adding Dto in this case is ugly and silly.
最后但并非最不重要的 String 是 char 数组的值,但在这种情况下添加 Dto 既丑陋又愚蠢。
Only really well known acronyms like Url should ever be used. In the end Store can never be confusing while all the acronyms you mentioned don't make things clearer and in this case introduced co fusion and this coated time.
只应使用非常知名的首字母缩略词,如 Url。最终 Store 永远不会令人困惑,而您提到的所有首字母缩略词都没有使事情更清楚,并且在这种情况下引入了 cofusion 和这个涂层时间。
If you measure the typing using what I have suggested you actually type less characters and everything is clearer. always aim for clarity rather than terseness after all we are all fast typers so what's a few extra chars. In the end we spend more time Reading, understanding etc than typing so a few extra chars in a class name isn't going to reduce productivity at all ...
如果您使用我建议的方法测量打字,您实际上输入的字符更少,一切都更清晰。始终以清晰而不是简洁为目标,毕竟我们都是快速打字员,所以还有一些额外的字符。最后,我们花更多的时间阅读、理解等而不是打字,所以类名中的一些额外字符根本不会降低生产力......
Don't skimp...do it properly from the beginning.
不要吝啬……从一开始就做好。
回答by Tony
This might be Command Object.
这可能是命令对象。
回答by Bhushan Bhangale
I have never heard of DCO but is it Data Carrying Object just another name for DTO?
我从未听说过 DCO,但它只是 DTO 的另一个名称吗?

