Some background:
Some of the projects I'm in charge of at work are basically mapping projects - we consume data from somewhere, and map that to our own types.
This is a part of a bigger process that ultimately unifies and translates data from different sources into a single data repository.
As a part of the mappings, we often have methods like this:
NormalizedData Normalize(RawData rawData)
{
return new NormalizedData()
{
PropA = rawData.A,
PropB = rawData.B,
// more of the same here
};
}
As more data sources are being normalized, the structure of the NormalizedData
changes (Unfortunately, not my design) and so in an attempt to make things easier to handle new properties being added, I've decided to populate all the properties of the normalized data - even if they are irrelevant to the specific data source:
NormalizedData Normalize(RawData rawData)
{
return new NormalizedData()
{
PropA = rawData.A,
PropB = rawData.B,
PropC = default,
PropD = default,
PropE = rawData.E,
// more of the same here
};
}
Now - the question is this:
Should I use PropC = default,
or PropC = null,
?
As a side note - leaving all these properties uninitialized is also an option I would consider, but only if the system will ever become stable enough. Currently, I'm forced to revisit projects that are already in production and add some more properties to the normalization process, so it's much easier to see what properties I have to add when all of the previous properties are already listed.