I have found myself wanting to do certain things in my programs only if a variable has changed. I have so far been doing something like this:
int x = 1; in
You can use getter/setter with dirty bit associated with each field. mark it dirty if the value is changed through setter, and force user to use setters