Marble Diagrams

Marble diagrams are frequently in videos and blog entries from the Rx team explaining how certain operators in Rx work.

For a video explanation of marble diagrams, see: Rx in Depth 2: Marble Diagrams; Select and Where (4:49)

Structure of a Marble Diagram

A marble diagram represents a call to an Observable operator, such as Observable.Select() or Observable.Where()). It takes the following form.

sample-marble.png

The leftmost line would be interpreted as follows: A value is passed into the operator when the IObserver.OnNext() function is called. The value is then transformed by the operator, and the transformed value is passed to the output IObserver.OnNext() function.

The rightmost line would be interpreted as follows: A value is passed into the operator when the input IObserver.OnNext() function is called. The operator ignores the value, and nothing is passed output observers..

Symbols on a Marble Diagram

There are a variety of symbols that are used as 'marbles' on marble diagrams, each with a different business continuity meaning. Here are some of the most common symbols used.

Symbol Meaning
Single value from an observable sequence. (from IObserver<T>.OnNext(T))
Value that has been transformed in some way
x Exception that terminates an observable sequence. (from IObserver<T>.OnError(Exception))
| Observable sequence has completed normally - no more values. (from IObserver<T>.OnCompleted())
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License