- Learning RxJava
- Thomas Nield
- 263字
- 2021-07-02 22:22:50
When to use RxJava
A common question ReactiveX newcomers ask is what circumstances warrant a reactive approach? Do we always want to use RxJava? As someone who has been living and breathing reactive programming for a while, I have learned that there are two answers to this question:
The first answer is when you first start out: yes! You always want to take a reactive approach. The only way to truly become a master of reactive programming is to build reactive applications from the ground up. Think of everything as Observable and always model your program in terms of data and event flows. When you do this, you will leverage everything reactive programming has to offer and see the quality of your applications go up significantly.
The second answer is that when you become experienced in RxJava, you will find cases where RxJava may not be appropriate. There will occasionally be times where a reactive approach may not be optimal, but usually, this exception applies to only part of your code. Your entire project itself should be reactive. There may be parts that are not reactive and for good reason. These exceptions only stand out to a trained Rx veteran who sees that returning List<String> is perhaps better than returning Observable<String>.
Rx greenhorns should not worry about when something should be reactive versus something not reactive. Over time, they will start to see cases where the benefits of Rx are marginalized, and this is something that only comes with experience.
So for now, no compromises. Go reactive all the way!
- Vue.js 3.x從入門到精通(視頻教學(xué)版)
- Java虛擬機(jī)字節(jié)碼:從入門到實(shí)戰(zhàn)
- 人臉識(shí)別原理及算法:動(dòng)態(tài)人臉識(shí)別系統(tǒng)研究
- YARN Essentials
- Windows Presentation Foundation Development Cookbook
- 編譯系統(tǒng)透視:圖解編譯原理
- 好好學(xué)Java:從零基礎(chǔ)到項(xiàng)目實(shí)戰(zhàn)
- Python 3.7從入門到精通(視頻教學(xué)版)
- Python從入門到精通(第3版)
- Android應(yīng)用開發(fā)實(shí)戰(zhàn)
- C++從入門到精通(第6版)
- Node.js從入門到精通
- Maven for Eclipse
- Java Web動(dòng)態(tài)網(wǎng)站開發(fā)(第2版·微課版)
- Spring MVC Blueprints