Question

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.

Was it helpful?

Solution

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.

OTHER TIPS

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top