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

Consider switching to plain C# types for the data model #20

Open
nblumhardt opened this issue Apr 19, 2018 · 5 comments
Open

Consider switching to plain C# types for the data model #20

nblumhardt opened this issue Apr 19, 2018 · 5 comments
Labels

Comments

@nblumhardt
Copy link
Contributor

Since this lib isn't itself a logging library, and so probably doesn't need to buy into a whole immutable data model, it seems like both perf and usability would be improved by adopting object[], Dictionary<string, object> and plain objects, instead of the ArrayValue, StructureValue and ScalarValue wrappers.

I.e., if I have a deserialized JSON object including a template, it's more likely I've deserialized it into plain collection types than the MessageTemplates data model, and more familiar/simpler to convert into them if I haven't.

Any thoughts on this?

@adamchester
Copy link
Member

I’d like to think some more about this...

@SimonCropp
Copy link
Contributor

+1

@SimonCropp
Copy link
Contributor

@adamchester still thinking?

@adamchester
Copy link
Member

Sorry for the delay... I think this is a great idea and probably the best default, especially if there was still a sensible way to enable snapshot capturing

@nblumhardt
Copy link
Contributor Author

👍 yes, snapshotting would still happen the same way as it does now - it's just that the wrapper types would be substituted for their native equivalents. E.g. when an array is logged, we allocate an array within a SequenceValue to snapshot it (and recursively do this to its contents). Under the alternative model, we'd just allocate the new object[] and treat it exactly as we do SequenceValue.

  • SequenceValue -> object[]
  • StructureValue -> Dictionary<string, object>
  • DictionaryValue -> Dictionary<object, object>
  • ScalarValue -> the value

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

No branches or pull requests

3 participants