is there any way to set up a binding between x and y so that if one changes, the other changes to the same value and vice-versa? This is a major simplification of the actual code/design, but if i could get this specific answer, it would be very helpful.
although it seems easy possible - it kinda seems code smell - if you want to entangle fields - then why just don't use a single field?
try to keep the same or dependent information is quite error prone - if possible the base data should kept only once and the dependent data should be evaluated at the time they're needed (aka in getters used to retrive dependent data instead of direct field access)
I know that JavaFX has a load of Observable classes, such as ObservableIntegerValue, but I don't know if they work outside of the JavaFX environment. Also, it would tie your code to Java 8 unless you import the JavaFX base. (JavaFX is no longer packaged with Java 9 and above).
All things are lawful, but not all things are profitable.
posted 3 months ago
That is a very interesting suggestion by Knute. I have no experience with JavaFX and its binding possibilities, time for me to try some things out!!
But here is a silly exapmple how you could do such a thing in Java:
There are three kinds of actuaries: those who can count, and those who can't.