In the previous article, we learned How to implement a React-like architecture in Kotlin. This part(s) will continue from where we stopped to show How to implement a Redux-like architecture, using RxKotlin. These two form the Reactdroid library, which is available on GitHub.
To remind you — on a high level, this is how Reactdroid’s Kotlin core is structured:
In previous articles, we talked about Why the current approach to native mobile development is not good enough and What is the suggested approach (React+Redux). This time we will see How to implement a React-like architecture in Kotlin and the next article(s) will talk about How to implement a Redux-like architecture using RxKotlin.
The final library — Reactdroid — is here on GitHub.
Both the React-like and the Redux-like implementations are pure Kotlin, to allow for Multiplatform development; and both have an extra Android-specific layer.
If you’re not yet familiar with the principles of React and Redux, please go back…
In the first part, we talked about Why the current approach to native mobile development is outdated.
This started our voyage to discover reactive-architecture alternatives for native apps, in Kotlin (Multiplatform?).
In this part we will talk about What is the suggested approach — React and Redux, in Kotlin.
And the next part will be about How it can be implemented and used.
To the What and the How then!
This is the last of the 3-part article(s) regarding the ‘Promise’ model in Kotlin.
This part concentrates on a specific Promise extension — the APromise — an Android Promise class. It adds Main Thread support and scoping to the Promise chain, to auto-cancel when the scope terminates — e.g. an Android View got detached.
Assuming you read the first part(s), you will learn how to extend the Promise model we’ve built in order to add features to it— in this case, Android features (It is available on GitHub, have a look!). We will start with scoping (context) and finish with…
This is the first part of a long list of articles I am about to write, which will cover Mobile (and specifically Android) Development in full and will provide a comprehensive architecture to building great, modern apps, in virtually no time. That said architecture is a reactive, component-based MVI, which has worked flawlessly in 2 production apps, and it’s about time it will see the light of day. It changed my professional life for the better, and it should be shared.
We’re all familiar with React.js and its great JSX extension for building UI components easily. It let’s developers write dynamic UI which is built directly from some data, or state, instead of having separated, static-UI code (e.g. xml or html) and dynamic state-binding code (e.g. ViewBinding or JQuery).
Android and iOS teams followed and developed their native equivalents to React+JSX — JetpackCompose and SwiftUI. Like React, they offer inner state-management, meaning, each ‘component’ can either control its own state, or be controlled by its ‘parent component’, which handles its own state… And like with React, they lack global state management…
When I was first introduced to Facebook’s React.js (and Redux) for web development, a few years ago, I was a little shocked, I admit — it had nothing to do with the familiar Android development I was used to.
From this point on, I will specifically talk about Android, but I assure you — iOS is no better, oh no.
Handling errors properly and elegantly is a major advantage of the ‘Promise’ model. The ‘catch’ clause also allows for resuming the chain by providing a new value or even a new Promise to recover from an Exception.
This is part 2 of ‘The Promise Model’.
In this chapter we will cover error handling, namely, the ‘catch’ clause. …