是否有这样的类型概念的名称
我有一个使用来自各个域实体的信息构建的类型。
类型本身之所以存在,是因为在系统的某些上下文中,从为该类型提供信息的大型且复杂的遗留类型中进行抽象是有用且有意义的。它公开了用于实例化它的类型的字段的子集,此外它还包含自己的一些功能。
该类型有自己的服务,提供创建方法,该方法在幕后协调构成该类型实例的域实体的创建和持久化。
这种类型的概念有名称吗?
它肯定是某种形式的集合。它当然是一种领域模型,但它是其他领域模型的外观。
在新建系统中,我怀疑对这种类型的需求会受到限制,但我发现它在处理不灵活的遗留代码库时很有用。
I have a type that is constructed using information from various domain entities.
The type itself is present because within some contexts in the system it is useful and meaningful to abstract away from the large and complex legacy types that supply the information for the type. It exposes a subset of the fields of the types used to instantiate it, plus it contains some functionality of its own.
The type has its own service, providing a creation method, that under the hood, coordinates the creation and persistence of the domain entities that make up instances of the type.
Is there a name for the concept of such a type?
It is certainly an aggregate of some kind. It is certainly a kind of domain model, but it is a facade onto other domain models.
In a greenfield system I suspect the need for such a type would be limited, but I have found it to be useful when dealing with inflexible legacy codebases.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为只是
Adapter
模式。或者,谈到它所包装的遗留问题,我想起了 Martin Fowler 的《重构》中有关
泥球
的内容 - 它说有时最好将其包装到漂亮的 API 中并将泥保留在里面。Simply
Adapter
pattern, I think.Or, talking about legacy it wraps, I recall something about
ball of mud
in Martin Fowler's "Refactoring" - that says that sometimes it's better just to wrap it into pretty API and keep the mud inside.我将为你的对象发明一个新术语 - ActiveFacade - 你首先在这里听到它;)
I will invent a new term for your object - ActiveFacade - you heard it here first ;)