I have a class that uses a hierarchy structure:

       string Id;
       string ParentId;
       //... other properties around 30
       Date ModifiedDate;
       Date CreationDate;

We have some kind of audit trail but is something like:

       string ClassId;
       Field FieldId; // with an enum for each property
       string OldValue;
       string NewValue;
       Date Date;

Now the customer wants to see the hierarchy structure at some point in time. (a Class can have only one parent but it can have multiple children)


A is parent for B and B is parent for C

on a point in time

D is the parent of C

For a date before the change the hierarchy should be A and B and C

For a date after the change the hierarchy should be A and B

Using the audit trail in the actual form would be a nightmare to determine the entire hierarchy at some point in time, so I though of storing the entire structure in an xml with a validity period. (The reason is that it needs only 4-5 properties to know at some point in time).

Are there other better solutions for storing the hierarchy changes

  • There's a lot missing from this question. Please define the customers need to "see the hierarchy structure" in more detail. Because with the description given, a perfectly valid answer is: "source control". May 12 at 13:39
  • @candied_orange Can you give more details to "source control" to investigate it
    – Dan
    May 12 at 14:41
  • @candied_orange For some reasons I believe its more about hierarchical information stored in a database and I suppose Class means some kind of DAO. @Dan you should loog for event sourcing which me help you building your audit log. May 12 at 15:51
  • Source control will let you check in old versions of your code, see exactly how it was changed, and provide a way to collaborate as your team works on it. May 12 at 15:51
  • 1
    Have a look at "Temporal Databases." May 12 at 18:44


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.