Traditionally, in order for UI to react to state changes, UI updates have to be triggered imperatively, from wherever the business model state has been altered. Although easy to implement, such a UI infrastructure is difficult to maintain, because one has to consider every current UI element that may need to be touched when any particular piece of data changes.
So instead, a more modern approach should be supported: UI elements listen for changes to the data related to them. Whenever that data is changed in any way, the UI elements interested in that data update themselves. This is a paradigm-shift from imperative to (mostly) declarative UI programming, which is far easier to maintain in the long run, but more work up-front to set up.
With this issue, the up-front work is to be completed. Its requirements are as follows.
- Data changes must be observable by UI elements interested in them.
- When a UI element is staged, it should automatically subscribe to the data it's interested in.
- When a UI element is unstaged, it should automatically unsubscribe any and all data changes, to obviate lingering references.
- How the data changed must be trackable. E. g. when an element in a collection is added, removed, moved or edited, then this specificity must be passed on to listeners. The same goes for non-collections. When a value is changed or any value within its nested properties is changed, then the exact change must be passed on to listeners.
Traditionally, in order for UI to react to state changes, UI updates have to be triggered imperatively, from wherever the business model state has been altered. Although easy to implement, such a UI infrastructure is difficult to maintain, because one has to consider every current UI element that may need to be touched when any particular piece of data changes.
So instead, a more modern approach should be supported: UI elements listen for changes to the data related to them. Whenever that data is changed in any way, the UI elements interested in that data update themselves. This is a paradigm-shift from imperative to (mostly) declarative UI programming, which is far easier to maintain in the long run, but more work up-front to set up.
With this issue, the up-front work is to be completed. Its requirements are as follows.