Overload Observer Pattern

I adhere to the following scenario. It has a smell of code that doesn't suit me, but permissions to it seem complicated, but in different ways.

I have a scene graph representing business objects. I designed it so that the business objects themselves were as simple as possible. They are practically POJO.

Now 1 object can be displayed in several areas of the scene graph by various nodes.

When an object changes, all the corresponding nodes in the scene graph must change.

I hesitate to use the observer pattern for all my objects, since I have more than 50,000 objects on the screen at the same time.

Since all changes are initiated from the view, right now I'm recursing along the scene graph and forcing all nodes connected to the changed object to be reloaded. Doesn't feel good though.

Any suggestions on how to do this better?

+3
source share
2 answers

Business Object == Entity? You have 50 thousand. Of these, represented as nodes on the screen, some objects have more than one node. The user action affects the state of the object and, therefore, some nodes must be updated. But, of course, entities do not know about nodes.

-, Entity. . , . , .

+3

, , .

+2

Source: https://habr.com/ru/post/1723253/


All Articles