开发者

Is there a name for the concept of a type such as this

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.开发者_如何学Go

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.


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.


I will invent a new term for your object - ActiveFacade - you heard it here first ;)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜