문제

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