- 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.
推薦閱讀
- 企業數字化創新引擎:企業級PaaS平臺HZERO
- SQL Server 2016 數據庫教程(第4版)
- 輕松學大數據挖掘:算法、場景與數據產品
- 卷積神經網絡的Python實現
- 文本數據挖掘:基于R語言
- Enterprise Integration with WSO2 ESB
- The Game Jam Survival Guide
- Spark大數據分析實戰
- Chef Essentials
- 探索新型智庫發展之路:藍迪國際智庫報告·2015(上冊)
- 爬蟲實戰:從數據到產品
- Visual Studio 2013 and .NET 4.5 Expert Cookbook
- 從實踐中學習sqlmap數據庫注入測試
- Spring MVC Beginner’s Guide
- Access數據庫開發從入門到精通