Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explore refs vs object graphs #24

Open
strangemonad opened this issue Dec 29, 2017 · 1 comment
Open

Explore refs vs object graphs #24

strangemonad opened this issue Dec 29, 2017 · 1 comment

Comments

@strangemonad
Copy link
Owner

Domain models tend to gravitate towards object graphs but that's shitty for lots of practical reasons. (NOTE: none of this deals with cardinality > 1 e.g. lists, sets, maps)

  1. hard to optimize DB access patterns, often wasteful (we don't need the whole graph)
  2. hard to control network wire size for clients that just want a view of things
  3. bad for memory footprint (heap or stack) and GC patterns of the process itself

Entity boundaries are sometimes fuzzy and often application specific. When modeling at a high level you sometimes care that the model is directly contained (i.e. the hierarchy's solid lines). Sometimes you care specifically that it's a reference to another entity. Sometimes you're happy with either a ref to the entity or that entity itself but you do care that access times are deterministic and controllable (ie when will the data be faulted in am I in the same DB transaction so that I'm seeing the same view of data, can I memoize the result, etc). Determining this starts broaching into linear types / linear logic

@strangemonad
Copy link
Owner Author

This has some parallels with using the modeled object vs type aliasing to an equivalent type in the target language #5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant