So let's get out of the illusion of comparing code one character at a time and try to find an abstraction that can be applied to updating all of these data types. There are two key points of this abstraction that have already been mentioned in the previous section:
A
change
contains the information that can transform the value of an item from one to anotherMultiple changes could be generated or applied to one data item during a single synchronization
Now, starting from changes, let's think about what happens when an update
method of a client is called.
Take a closer look to the method update
of client:
For data of the
'value'
type, first we create the change, including a new value, and then update the change list to make the newly created change the only one. After that, we update the value of data item.For data of the
'increment'
type, we add a change including the increment in the change list; or if a change that has not be synchronized already exists...