reactivemarbles / DynamicDataVNext

MIT License
14 stars 0 forks source link

Prototype/Proposal for surface of source collections. #3

Closed JakenVeina closed 3 months ago

JakenVeina commented 3 months ago

Main thoughts:

RolandPheasant commented 3 months ago

Some quick first thoughts:

ReactiveList

Version 2 of Dynamic Data which was never published was called ReactiveList. I abandoned that name when I discovered RxUI, who at the time had an object called ReactiveList.

Object Naming

It was never my intention to create a facsimilie of List and Dictionary, they just happened to evolve that way. I soon regretted it as people wanted a them to do everything that a list or dictionary does! I much prefer to keep the naming neutral and and use DataSource<T> and DataSource<TObject, TKey>. That way we are free to implement our own interpretation.

No Connect()

Surely there's a convention for this ToObservable() - it was another of my regrets, not just to use that,

.SuspendNotifications()

I suspect that could be really useful.

JakenVeina commented 3 months ago

It was never my intention to create a facsimilie of List and Dictionary

Whereas, for me, I see VALUE in making facsimilies of List and Dictionary. It's not like any methods on the List and Dictionary interfaces are incompatible with our model of changes and changesets, or are hard to implement. And if we don't have the source collections implement IList<>, IReadOnlyList<>, etc. I don't see the implementations being any different.

Surely there's a convention for this ToObservable() - it was another of my regrets, not just to use that,

I'm not really sure what you mean. In your mind, what would .ToObservable() upon a source collection actually do? I don't see any actual use for a .ToObservable() method, except for what I mentioned already, and for that we'd want .AsObservable().

RolandPheasant commented 3 months ago

Ok,

I'll roll with using the notion of List and Dictionary in the semantics for the replacement for Source List / Cache.

But I would add that we should probably think of these 'data sources' as subjects, which is in fact what they are. They are also amendable which is why they require the add, remove methods etc.

Perhaps ListSubject<TItem> and DictionarySubject<TKey, TItem> ? How about AsReadOnly() to hide any edit methods and make these ObservableList<TItem> and ObservableDictionary<TKey, TItem>? Again, close to the original but also semantically inclusive of storage type

... btw you have probably spotted that I am really not a fan of long names!

Also we probably should not get caught up too much on naming because at any time before the first release we can refactor en-mass

You're right regarding .AsObservable() - ignore me on that !

JakenVeina commented 3 months ago

But I would add that we should probably think of these 'data sources' as subjects

That is an excellent way to think about it.

Perhaps ListSubject and DictionarySubject<TKey, TItem> ? How about AsReadOnly() to hide any edit methods and make these ObservableList and ObservableDictionary<TKey, TItem>?

I love it. With the caveat that IObservableList<T> and IObservableDictionary<TKey, TItem> would eliminate the need for an .AsReadOnly() method (or at least, eliminate the need for it to be an allocation). Plus, it still leaves open the opportunity for other implementations of those interfaces. Also, that makes it mirror RX even MORE. Subject<T> implements IObservable<T>, SubjectList<T> implements IObservableList<T>, SubjectDictionary<TKey, TValue> implements IObservableDictionary<TKey, TValue>, etc... Who doesn't love when code rhymes?

Now my head's also wondering if there's value for an IObserverList<T> and IObserverDictionary<TKey, TValue>. Probably not, lol.

github-actions[bot] commented 2 months ago

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.