Model-Domain-Mismatch for inputs and input groups
Inputs can be assigned to a group, but can also be stand-alone. This leads to a mismatch between models and the domain, because both of them need to reference their experiment.
The domain requires:
type ExperimentId = Int
type GroupId = Int
data Input = Standalone ExperimentId | Grouped GroupId
Our database model has:
type ExperimentId = Int
type GroupId = Int
data Group = Group ExperimentId
data Input = Input ExperimentId GroupId
As a result it is possible to have inputs of an experiment E1
, which belong to a group A, which belongs to an experiment E2
. This introduces a potential source of bugs. I don't have any good idea how to solve this.
One possibility is to let inputs belong to a generic Parent
, which can be either an input group or an experiment. I don't really like the overhead with that.