Skip to content Skip to sidebar Skip to footer

Rx Net In Action Pdf Download

A bright future for Functional Reactive Programming and .NET developers

David Bottiau

Introduction

During the last few years, I felt in love with Functional Reactive Programming. My first experience was when I used Rx.NET on a Windows 8 C#/XAML application. I used Reactive programming to simplify and improve performance of the UI with a dynamic Grid splitter. I then improve my skills on Rx.NET and rxjs to the point I am fully aware of the benefits of the Observable thing even if I do not know every operator in the world.

But FRP isn't just Rea c tive, it is also Functional. I learnt Functional Programming more recently by studying the concept and by making some projects in F#, a functional programming language and also React/Redux which I know now is made of pure functions by default. But again, I am not expert either. I can't remember what is a monad.

When my brain hear the word "Monad" — Picture of La Gioconda

So, Functional Reactive Programming is bringing the best of those two worlds and I started bringing amazing stuff for FRP and .NET developers. Let's see what you can get today.

A Redux library for .NET developer

The first (and easiest) programming paradigm is what js developers call Redux. It is a frontend library designed to store the data application in a single object (state) and updated only via reducers (pure functions). Also, React/Redux applications follow a UI-Data pattern while .NET developers are more familiar with MVVM pattern.

Differences between a React/Redux application and a C#/XAML application

So, I created ReduxSimple, a .NET library using Rx.NET that can looks like a combination of the famous redux library by Dan Abramov and the amazing redux-observable library by Jay Phelps.

ReduxSimple logo

ReduxSimple offers a clean architecture and a familiar API considering:

  • A unique store which contains a single state at any given time
  • A Dispatch function to start the update of the store (or starting async actions)
  • A Reduce function that takes an action and return a new state
  • A list of Subscribe methods to any state changed or action dispatched
  • And some useful features like time travel

If you are curious, you can also download the sample app on the Windows Store and learn on the fly. Or if you need a readme file, consider this one https://github.com/Odonno/ReduxSimple/blob/master/README.md

Counter example on the sample app of ReduxSimple library

Like I said, a Redux library is not the hardest thing to make in the world. You can check my 100 line of codes that prove what I tell you. But the goal is to start small while aiming at a bigger vision: to bring a 1st class experience of Functional Reactive Programming for .NET developers.

A UI Component library for .NET developer

Like we saw previously, there is a huge difference between a Redux-like application and a C#/XAML application. Making a Redux library helped me realize the benefits of UI composition and functional components. Things that XAML never did or not perfectly. The closest thing to it is User Control which is not that good.

The goal of this library would be to liberate XAML developers to write simple and reusable components. And my take on this will be to bring to an FRP library to design XAML application in a Reactive way.

Unfornutely, there is no such library and the most advanced experiment on this is the Clay library designed by Toni Petrina.

I think we share the same dream and you can have a glimpse of the future it might look by reading this article http://massivepixel.co/blog/post/react-xamarin-forms

The best option for app developers will be to write XAML in C# code like web developers write HTML in JS code with JSX. This is a future I am eager to see.

A back-end library for .NET developer

And finally to complete the family I think some of you are also fullstack developers. What can be greater than having a frontend FRP stack? A backend FRP stack too!

I did not look at it recently but what bothers me when writing ASP.NET web backend/API is the excessive amount of code and the lack of reusability. What could make this world better is to bring FRP to the table of ASP.NET technology stack with:

  • A Functional approach (each request is handled as a single "pure" function)
  • A Reactive approach (to handle requests at the top layer: filter requests, simplify realtime communication)
  • CQRS by default
  • Event Sourcing ready (easier implementation with CQRS by design)
  • Not particularly required but why not GraphQL-compliant (because graph representations are eating the world)
  • And the list is constantly growing…

Beyond .NET

.NET is a rich ecosystem. My predominant programming languages are C# and TypeScript and I feel like a better world can emerge from bringing exceptional developer experiences on the JavaScript ecosystem into .NET.

My target is currently C#/.NET and primarily the UWP/WPF platform to improve the process of creating Windows applications but a better future for .NET developers is IMO also a better future for every developer writing applications whether it is a web application, a desktop application or even a mobile application.

Make it happen

If you share the same dream and if you want to see it tomorrow, please start by following upcoming news on my twitter and contribute to projects on GitHub starting with ReduxSimple. If you have any idea on this topic, note that I am open to discussion.

Thank you.

Photo by Manuel Cosentino on Unsplash

Posted by: lindseycashawe0198017.blogspot.com

Source: https://medium.com/@dbottiau/a-bright-future-for-functional-reactive-programming-and-net-developers-54780cd2f838

Post a Comment for "Rx Net In Action Pdf Download"