Use of Unit ID, Scientific Study #291
Replies: 8 comments 5 replies
-
I recall having issues when de-serializing those object references in the past. That's why we switch to saving a person's id instead of its problematic object reference. |
Beta Was this translation helpful? Give feedback.
-
It certainly makes the code slower because of the lookups. Also there us a difference in approaches in different areas which is never good.Worth addressing as a future task.On 17 Dec 2020 17:47, manny kung <notifications@github.com> wrote:
Why do some of the classes use the Unit identifier instead of keeping a reference to the real Unit object?
I recall having issues when de-serializing those object references in the past.
That's why we switch to saving a person's id instead of its problematic object reference.
—You are receiving this because you authored the thread.Reply to this email directly, view it on GitHub, or unsubscribe.
|
Beta Was this translation helpful? Give feedback.
-
The ID could make sense for storing historical data and separating it, but then we should use it consequently, where it applies: If the actual simulated person is not needed, but actually just a bureaucratic record of its past existence, an ID to this record should be used, while in present actions, the actual person should be used as subject or object of the action/verb. Looking up if the person still exists and fetch its current data, is no performance concern, if this happens only rarely, like by a user browsing historic data or some AI action taking place to specifically locate the person mentioned. This could also simplify a migration of Mars Sim to clusters, since the full data of a Person would no longer be required everywhere, just its global reference. |
Beta Was this translation helpful? Give feedback.
-
So, let's break it apart and have a |
Beta Was this translation helpful? Give feedback.
-
Let's rework it and split into Settlement focused. It also makes the code more thread safe as these global objects can be updated by multiple simulation tasks. |
Beta Was this translation helpful? Give feedback.
-
I have some spare time before going back to work so I will start o spltting the ScientificStudyManager into a Settlement orientated implementation. |
Beta Was this translation helpful? Give feedback.
-
So here's the approach to the ScientificStudyManager
|
Beta Was this translation helpful? Give feedback.
-
I have committed a rework of the Science classes. The goal was to remove the updates from teh Scientific Study manager so the studies can be updated in align with the associated Settlement. The Scientific Study instances are now "owned" by the lead researcher and hence updated as part of their update. |
Beta Was this translation helpful? Give feedback.
-
Why do some of the classes use the Unit identifier instead of keeping a reference to the real Unit object?
For example in
ScientificStudy
collaborators are managed by their identifiers which means an expensive lookup in the UnitManager to convert it to a object. It is so that they can be used as keys in Map objects? The real Unit object can be used just as easily if they have a correctly implement equals & hashCode method.Beta Was this translation helpful? Give feedback.
All reactions