- Hands-On Reactive Programming with Python
- Romain Picard
- 454字
- 2021-06-24 18:25:14
Reactivity diagram elements
Reactivity diagrams can be constructed from the following elements:
- Circles: Observables are represented as circles. An input observable is represented as a black circle. An output observable is represented as an encircled black circle. Two other notations allow us to indicate when actions are done: when an observable terminates on completion or on error. This notation is similar to the marble diagrams; an observable error event is represented as a circle with a cross in it, and an observable completion event is represented as a circle with a bar in it. This is shown in the following figure:
Figure 1.13: Observable notations. From left to right: input, output, error, completion
- Rectangles: Operators are represented as rounded rectangles. The text inside the rectangle describes the actions being performed. The first line contains the name of the operator and its parameters. The following lines contain the description of the action. This notation can also be used for components being used in the current component. This notation can also be used as a merge point for operators that combine several observables. This is shown in the following figure:
Figure 1.14: Operators notation
- Flow: Items flows are represented as arrows. The type of items emitted on the observable is written near the arrow. Item flows show how operators and other elements are linked together. This is shown in the following figure:
Figure 1.15: Items flows notation
Diamond: Decisions are represented as a diamond. The decision notation is used only for operators that take an observable as input and split it into two or more observables, the split being based on a segmentation logic described in the diamond. The text inside the diamonds describes the segmentation logic in the same way as the operator's notation. This is seen in following figure:
Figure 1.16: Decisions notation
- Horizontal or vertical black bar: Share and merge are represented as a horizontal or vertical black bar. An observable is shared when there is one incoming observable and several outgoing observables on the bar. Observables are merged when there are several incoming observables and one outgoing observable on the bar. This is demonstrated in the following figure:
Figure 1.17: Share and merge notation: share (center), merge (right)
- Rectangle with the upper-right corner bent: Out of monad actions are represented as a rectangle with the upper-right corner bent. Out of monad actions are the actions that are not done via an operator or a component operating on observables. The typical usecase is the code of the subscription associated to an observer. The text in the rectangle describes briefly the actions being done. This can be seen in the following figure:
Figure 1.18: Out of monad notation
推薦閱讀
- Cybersecurity:Attack and Defense Strategies
- Mobile-first Bootstrap
- Linux從零開始學(視頻教學版)
- 無蘋果不生活 OS X Mountain Lion隨身寶典
- 高性能Linux服務器構建實戰:運維監控、性能調優與集群應用
- 嵌入式Linux應用開發菜鳥進階
- Linux使用和管理指南:從云原生到可觀測性
- Mobile First Design with HTML5 and CSS3
- 細說Linux基礎知識
- Mastering Reactive JavaScript
- Kali Linux高級滲透測試(原書第3版)
- Windows Vista終極技巧金典
- Linux操作系統
- Hadoop Real-World Solutions Cookbook
- iOS 10快速開發:18天零基礎開發一個商業應用