- Reactive Programming in Kotlin
- Rivu Chakraborty
- 266字
- 2021-07-02 22:26:36
Reasons to adapt functional reactive programming
So, let's first discuss the reasons to adapt functional reactive programming. There's no point in changing the whole way you code unless it gets you some really significant benefits, right? Yes, functional reactive programming gets you a set of mind-blowing benefits, as listed here:
- Get rid of the callback hell:
A callback is a method that gets called when a predefined event occurs. The mechanism of passing interfaces with callback methods is called callback mechanism. This mechanism involves a hell of a lot of code, including the interfaces, their implementations, and more. Hence, it is referred to as callback hell. - Standard mechanism for error handling:
Generally, while working with complex tasks and HTTP calls, handling errors are a major concern, especially in the absence of any standard mechanism, it becomes a headache. - It's a lot simpler than regular threading:
Though Kotlin makes it easier to work with threading as compared to Java, it's still complicated enough. Reactive programming helps to make it easier. - Straightforward way for async operations:
Threading and asynchronous operations are interrelated. As threading got easier, so did the async operations. - One for everything, the same API for every operations:
Reactive programming, especially RxKotlin, offers you a simple and straightforward API. You can use it for anything and everything, be it network call, database access, computation, or UI operations. - The functional way:
Reactive programming leads you to write readable declarative code as, here, things are more functional. - Maintainable and testable code:
The most important point-by following reactive programming properly, your program becomes more maintainable and testable.
推薦閱讀
- Hands-On Data Structures and Algorithms with Rust
- Python絕技:運用Python成為頂級數(shù)據(jù)工程師
- 數(shù)據(jù)庫原理及應(yīng)用教程(第4版)(微課版)
- 數(shù)據(jù)之巔:數(shù)據(jù)的本質(zhì)與未來
- MySQL 8.x從入門到精通(視頻教學(xué)版)
- 信息學(xué)競賽寶典:數(shù)據(jù)結(jié)構(gòu)基礎(chǔ)
- Apache Kylin權(quán)威指南
- Python數(shù)據(jù)分析與挖掘?qū)崙?zhàn)(第3版)
- 菜鳥學(xué)SPSS數(shù)據(jù)分析
- Visual FoxPro數(shù)據(jù)庫技術(shù)基礎(chǔ)
- 云計算寶典:技術(shù)與實踐
- 離線和實時大數(shù)據(jù)開發(fā)實戰(zhàn)
- Cognitive Computing with IBM Watson
- ECharts數(shù)據(jù)可視化:入門、實戰(zhàn)與進階
- 基于數(shù)據(jù)發(fā)布的隱私保護模型研究