This question is a clarification of my question. Various ways of observing data changes .
I still have many classes in my C ++ application that are often updated (or can be updated) in complex mathematical procedures and in the difficult parts of business logic.
If I go to the "observer" approach and send notifications every time I change the value of an instance, I have two big risks:
- sending notifications themselves can seriously slow down applications
- if user interface elements need to be updated by a change, they are updated with each change, resulting in, for example, screens being updated thousands of times when some part of the business logic is executed.
Some problems can be solved by adding buffering mechanisms (when you send notifications, when you start with the algorithm, and when the algorithm is complete), but since business logic can be executed in many places in the software, we add buffering almost everywhere after every possible action selected in the menu.
Instead of observer aproach, I could also use the mark-dirty approach, only marking the changed instances and at the end of the action telling the user interface that it should update itself.
Again, business logic can run throughout the application, so in practice we may need to add an extra call (telling about all the windows they need to update) after almost every action the user takes.
, :
( : : ).
, , , , , . , , - , , , ( ).
, " " . , , ( ).
? ?
, /datamodel . , .
?