Timeline for Is breaking encapsulation a necessary compromise for serialization?
Current License: CC BY-SA 4.0
12 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Nov 5, 2024 at 8:13 | vote | accept | pulpicated | ||
| Nov 5, 2024 at 1:32 | comment | added | Bergi | "The problem is that I need OpenFile.file to always correspond to an entry in Project.projectFiles" - the OpenFile class you have already doesn't guarantee that. How are OpenFile instances constructed? And which entity controls the list of currently open files (that belong to a project)? | |
| Nov 4, 2024 at 19:52 | history | became hot network question | |||
| Nov 4, 2024 at 16:30 | answer | added | JimmyJames | timeline score: 4 | |
| Nov 4, 2024 at 15:12 | comment | added | JimmyJames | Are you using Java's built-in serialization? Please specify what kind of approach you are using. | |
| Nov 4, 2024 at 11:07 | answer | added | Steve | timeline score: 3 | |
| Nov 4, 2024 at 7:52 | comment | added | Mike Nakis | "The problem is that I need OpenFile.file to always correspond to an entry in Project.projectFiles" -- you have failed to explain why this problem happens. Presumably you are implying that sometimes OpenFile.file does not correspond to an entry in Project.projectFiles. Why doesn't it? What kind of serialization are you doing which prevents this from being the case? | |
| Nov 4, 2024 at 7:34 | review | Close votes | |||
| Nov 9, 2024 at 3:08 | |||||
| Nov 4, 2024 at 7:27 | comment | added | freakish | So your project is actually a directed graph, while files are its nodes. In this setup I find the following API cleaner and easier to work with: let the FileRef be just an int, and always use Project explicitly when dealing with it. That way FileRef remains a plain data object, and it is also clear that it is meaningless without the project. Which is exactly the case. Then there are no circular dependencies, (de)serialization becomes simple. Usage is only slightly more complicated, but at least it is explicit, which I often prefer. With this setup you don't need separate OpenFile class as well | |
| Nov 4, 2024 at 3:37 | answer | added | candied_orange | timeline score: 11 | |
| S Nov 4, 2024 at 2:53 | review | First questions | |||
| Nov 4, 2024 at 9:31 | |||||
| S Nov 4, 2024 at 2:53 | history | asked | pulpicated | CC BY-SA 4.0 |