- 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
推薦閱讀
- 嵌入式Linux開發技術
- Linux操作系統基礎
- 無蘋果不生活 OS X Mountain Lion隨身寶典
- Windows Server 2012 Hyper-V Cookbook
- Linux集群和自動化運維
- Windows Vista融會貫通
- 混沌工程實戰:手把手教你實現系統穩定性
- Linux系統安全基礎:二進制代碼安全性分析基礎與實踐
- Dreamweaver CS5.5 Mobile and Web Development with HTML5,CSS3,and jQuery
- INSTANT Migration from Windows Server 2008 and 2008 R2 to 2012 How-to
- Windows 8實戰從入門到精通(超值版)
- Linux 從入門到項目實踐(超值版)
- 大學計算機應用基礎實踐教程(Windows 7+MS Office 2010)
- OpenStack Essentials(Second Edition)
- OpenHarmony開發與實踐:基于紅莓RK2206開發板