title: Versioning of domain model
body: <p>I implement versioning for my own domain model (tracking of differences in objects during update operations). Domain model has a tree structure. E.g. (<strong>-></strong> is reference)</p>
  
  <pre><code>A
  |-&gt; B
  |-&gt; C -&gt; A
      | -&gt; C
  </code></pre>
  
  <p>Requirements for versioning are following:</p>
  
  <ul>
  <li>Get the set of changed fields between two versions of domain object;</li>
  <li>Domain model has a tree structure;</li>
  <li>Fields can be organized in lists. In following example system should show that Y element was removed (but not that Z was removed and Y changed its state on Z) and X was changed:</li>
  </ul>
  
  <pre><code>
        [ v1 ]              [ v2 ]
          A                    A
          |-> [X, Y, Z]        |-> [X, Z]
               |-> C                |-> M
  </code></pre>
  
  <ul>
  <li>There are no more requirements like locking/merging/branching.</li>
  </ul>
  
  <p>I investigate the way to get change set between two states of the same object. I work with Java and interested in exist approaches/solutions. E.g. I'm looking for description of algorithm that subversion use to create next revision.</p>
  
  <p>I will glad to get any theoretical or practical advice from your side.</p>
  
  <p>Thanks</p>