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.

有帮助吗?

解决方案

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 ;)

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top