blw-ofag-ufag / eCH-0261

eCH-0261 -- Agrardaten - Betriebs- und Unternehmensstammdaten
1 stars 0 forks source link

Proposed standardised ValidityForMutables #26

Open montanajava opened 7 months ago

montanajava commented 7 months ago

Create an reusable element called ValidityForMutables.

This is very similar to:

https://github.com/blw-ofag-ufag/eCH-0261/issues/19

with the following changes:

The name of the element is of course not great: Ideas welcome.

This does not replace Validity, rather it is proposed as an addition thereto.

Architectural Considerations The motivation of this class is that using Validity for mutable classes includes a misnomber: An instance of a mutable class does not supersede an "Id" but in fact an iteration of the same id.

The word iteration was chosen because in many programming languages or frameworks the word "version" is already reserved, or taken or occupied. "version" in those settings refers to a technical version, whereas here, "iteration" is most definitely a domain-specific attribute.

montanajava commented 7 months ago

If this proposal is accepted, then references to Validity where an additional "version" was heretofore used, would have to be updated, e.g., eCH-0263, ManureAndRecyclingProduct (sic).

AFoletti commented 7 months ago

I am not sure I understand how this can work and how it is different from what already done and discussed in #19

If you have the very same object (same ID) it can only exist in one iteration at any given time. If you have multiple iterations of the same object coexisting in time they have to be actually different objects. Proof of that is that you can only differenciate them by ID+iteration value, actually building a new composite ID. This would however be a technical implementation thing and should have no place in our standard.

The "iteration" attribute has in my opinion another issue: what if an object needs diverging histories?

  1. Object 1 (iteration 0) is defined by organization A
  2. Object 1 is updated by organization A (iteration 1)
  3. Organization B creates yet a new version of Object 1, based on iteration 0. Is it iteration 1 or 2? Formally 1, since based on 0 and not the "old" 1. We now have two Object 1 with iteration 1...

To sum up:

My proposal is to leave it be and keep the class as discussed in #19, without any iteration info

montanajava commented 7 months ago

The motivator was PSM data, which does in fact mutate over time. I agree that an iteration without a change in ID is, in effect, a composite key.

Well architected systems do not do what you described in diverging histories. A consuming system of PSM data would thus not change data but rather forward any required change to the source system for the change to be made there.

I just felt that the present Validity class did not cover cleanly this PSM edge case. But probably such an edge case does not belong in a standard at all! Thanks for taking a look. From my point of view, you can close it if with a resolution “won’t fix.”

AFoletti commented 7 months ago

Well architected systems do not do what you described in diverging histories. A consuming system of PSM data would thus not change data but rather forward any required change to the source system for the change to be made there.

I see your point and I 100% agree with you.

Nevertheless, you put forward a system (as in "technical implementation") example, while my reasoning was more at the conceptual level.

I would be interested in other opinions and will let @lars-steffen close the ticket with the chosen resolution.