DCI(数据、上下文、交互)持久性示例
我见过的所有 DCI 示例似乎都是基于对象作为信息的最终持有者,并且事务边界是在方法内部定义的。
我想看一个持久性应用程序的示例,其中存在某种持久性层,即其中可以存在底层持久性存储的重复对象副本,并且对对象的更改是对稍后将要执行的副本的更改。坚持下去。 DCI 是否适用于该模型?
All the examples of DCI I've seen seems to be based on the object as the ultimate holder of information, and the transaction boundaries are defined inside the methods.
I would like to see an example of a persistent application, where there is some sort of persistence layer, i.e. where there can be duplicate object copies of the underlying persistence storage and where a change to an object is a change to a copy that will later be persisted. Does DCI work for that model at all?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
DCI 是一种范例,正如您可以使用任何其他具有持久性的范例来构建应用程序(不包括纯 FP,因为持久性是一种副作用),您也可以使用 DCI。 DCI 示例中没有提及它,因为它不涉及范式,并且与理解范式无关。 (也就是说,您不是第一个提出这个问题的人,我确信也不会是最后一个)。
对持久数据的关注通常与 DCI 正交。 DCI 尝试将设计划分为
第一个是领域模型,第二个是系统的功能。
“系统是什么”是否保存在内存、平面文件或数据库中当然很重要,但需要单独考虑,并且通常使用 受限面向对象
DCI is a paradigm and just as you can build an application using any other paradigm with persistence (execluding pure FP since persistence is a side effect) so can you with DCI. It's not mentioned in DCI examples because it's not a concern to the paradigm and is unrelated to understanding the paradigm. (That said you're not the first to ask the question and will not be the last I'm sure).
The concern of persisting data is in general ortogonal to DCI. DCI tries to partition the design into
The first is the domain model and the second is the functionality of the system.
Whether "what the system is" is kept in memory, flat files or a DB is important of course but a separate concern and is usually implemented using restricted OO
DCI 并不真正关心持久性。
DCI doesn't really concern itself with persistance.
位于 http://blog.maxant.co.uk/pebble/files/dci_java_example_for_object_composition_google_group_201010052226。 zip 我已经发布了一个 Java 示例,其中包含用于持久化实体的 JPA (ORM)。
它是即将在 www.maxant.co.uk/whitepapers.jsp 上发布的白皮书的一部分。
该白皮书中将提供展示 DCI 集成到应用程序服务器中的进一步示例。希望有帮助!
At http://blog.maxant.co.uk/pebble/files/dci_java_example_for_object_composition_google_group_201010052226.zip I have posted an example in Java, which incorporates JPA (ORM) for persisting entities.
It's part of a white paper to be posted soon at www.maxant.co.uk/whitepapers.jsp
A further example showing DCI being integrated into an app server will be in that paper. Hope that helps!