Synchronization is unreadable and error-prone
rmnldwg opened this issue · comments
I think my attempt of synchronizing the attributes of the ipsi
and contra
instances in the Bilateral
model class are bad: It's hard to understand what's going on, the state of some objects changes "magically", one cannot even look up what is synchronized, and I am loosing my mind over it.
However, I think there may be simpler and more elegant solution: A SynchronizerMixing
, in a similar fashion to the DelegatorMixin
: Such a mixin class could dynamically create methods and properties that keep e.g. some ipsi
and contra
attributes in sync. The advantage would be that the entire synchronization is now the responsibility of the Bilateral
(or Midline
) class. The ipsi
and contra
objects would - on their own - still work as expected and not leak anything to each other via obscure synchronization callbacks.
This could be much easier to test, as well.