We have a specification where we
- build 84 configurations
- define 167 relations between the 84 configurations
- add all of the 84 configurations to one joint configuration
My issue is twofold:
- I find the last part repetitive: We're using 84 LOC on adding all the configurations to the joint one.
- When we add a new configuration, we often forget this caveat of adding the new configuration to the joint one.
My own trail of thought has been to combine the first step and third step, but I haven't found a way of doing that while still being able to refer to the configurations for the second step.
Do you have any suggestions on how to improve this?
The relevant parts of the code looks like this:
var x = X.Build()
var y = Y.Build()
var z = Z.Build()
// 84 times
x.AddRelation(y)
x.AddRelation(z)
// 167 times
var config = new Config(...) {
Entities =
{
x,
y,
z,
// 84 times
}
}
Due to the lack of Detail this is the best I can give you atm.