General guidelines
API
The main API provided by this package is IFeed<T>
which represents a stream of data.
Unlike IObservable<T>
or IAsyncEnumerable<T>
, feed streams are specialized to handle business data objects which are expected to be rendered by the UI.
A feed is a sequence of messages which contains immutable data with metadata such as its loading progress and/or errors raised while loading it.
Everything is about data, which means that a feed will never fail. It will instead report any error encountered with the data itself, remaining active for future updates.
Each Message<T>
contains the current and the previous state, as well as information about what changed.
This means that a message is self-sufficient to get the current data, but also gives enough information to update from the previous state in an optimized way without rebuilding everything.
Good to know
- A basic feed is state-less. The state is contained only in messages that are going through a given subscription.
- The data is expected to be immutable. An update of the data implies a new message with an updated instance.
- As in functional programming, data is optional. A message may contain data (a.k.a.
Some
), the information about the fact that there is no data (a.k.a.None
) or nothing at all, if for instance the loading failed (a.k.a.Undefined
). - Public feeds are expected to be exposed in property getters. A caching system embedded in the reactive framework will then ensure to not re-create a new feed on each get.