0

The title was inspired by this question.

Hello there!

Im currently implementing an Hexagonal Architecture following DDD. In a usecase of the application, im using a sort of third service abstraction over an API that exposes a Machine Learning Model.

it receives as input a domain aggregate and returns an score.Can this ml model service fit in the definition of a Repository? in case of negative response, in which category this abstraction fits?

I not sure how to interpret this specific case, thanks in advance for your help!

ElPapi42
  • 493
  • 6
  • 19

1 Answers1

4

Can this ml model service fit in the definition of a Repository?

From your description, no...; I think you are looking in the wrong place.

REPOSITORY is a lifecycle management pattern; it suggests that we hide all of the details of loading and storing domain entities behind a facade that presents the illusion of an in memory collection.

What I think you want is a DOMAIN SERVICE, which is a modeling pattern.

A SERVICE is an operation offered as an interface that stands alone in the model, without encapsulating state, as ENTITIES and VALUE OBJECTS do.

See Evans 2003 ("the Blue Book"), Chapter 5.

VoiceOfUnreason
  • 52,766
  • 5
  • 49
  • 91