Visualizing sequences

As we already know from part 1 an Observable is a sequence of ongoing events in time. These sequences and their compositions and transformations can be nicely visualized by marble diagrams in either textual or graphical representation. The visualization of Observables makes it very easy to understand what is going on even if you are not an expert in Reactive Extensions.

Textual representation

There is a simple textual representation that uses the following symbols:

–>Timelineflows from left to right
OItem emitted by a sequencewhen called OnNext
XAbnormal terminationwhen called OnError
|Successful completionwhen called OnCompleted

A sequence with 3 items looks like this:


Combining sequences

The following diagram visualizes the Select(f) operator applied to Seq1 that creates a result stream (Result) where each emitted value of Seq1 is replaced according to the function f. In this case f adds one to the input value:

Seq1   --1---2-----3---->
       Select(x => x + 1)
Result --2---3-----4---->

Graphical representation

Here is the graphical representation of the example from above:


Weitere interessante Artikel