Combining Functional and Reactive Programming allows us to benefit from both styles. In a .NET MAUI app using C#, we can achieve this by using the ReactiveUI and Language-Ext libraries alongside the built-in language support for functional idioms, such as immutability through the record type and read-only collections.
Code written in a Reactive Programming style is declarative and operates on streams of data and events, making it easier to understand. The Functional Programming style with Monads enables a functional approach to error handling, facilitating a clearer understanding of the application flow. Using types and collections that support immutability alongside pure, side-effect-free functions enhances code predictability, reduces error susceptibility, and improves concurrency suitability. As a result, this leads to a cleaner and more modular app design, allowing for more efficient addition of new features.
This article refactors the People In Space MAUI demo app we built in the article Using ReactiveUI with .Net MAUI to create offline-capable apps to adopt a more functional style while retaining the Reactive Programming benefits.