Hey, I’m Andrey, I’ve been contributing to Status for 5y now and I’ll start this topic by giving a short overview of what’s happening atm in status mobile app development:
Mobile app is being developed with next technologies:
- React Native framework (developing mobile apps with JavaScript)
- ClojureScript programming language (compiles into JavaScript)
- re-frame framework (golden bullet, gives us faster development with the robust and clean code base, reduces the number of bugs, caused by code complexity, actually nullifies them
Is this stack good enough? the short answer is yes
BUT
performance is a PITA
JavaScript is slow and we’re running all business logic at the same time as RN runs its code in JS as well, which leads to UI and the entire app slowness
How we could stay with this stack but make our app better?
There are two major parts:
1. New React Native architecture
in short in the current architecture RN uses the bridge, where it communicates between JS and Native code sending json messages, its really slowdown RN components, and uses a lot of JS thread time, in the new architecture C++ objects will be shared between Native and JS runtime, so methods can be invoked directly, no need in json bridge anymore.
More and more RN components will be migrated in 2022 to the new architecture and we should use them for improving app performance.
Currently, we’re looking at how we could improve the messages list component first
But most importantly, we must
2. Move all business logic to status-go
status-go implemented as RN module, so it also communicates through the bridge and new architecture will improve performance a lot
also currently business logic is split between status-go and status-react, for example when we want to show messages we request them from status-go and prepare in some form but then we still have to make lots of computations in status-react (JS) because we need to modify the data according to current app state (status-go doesn’t have an app state)
and latest, we have now a desktop app and it will be a huge win if we’ll have entire business logic in the same code base for both mobile and desktop (currently it’s approx 5% i guess or even less)
BUT it would be really great if we could keep re-frame framework, and move the business logic as re-frame events (pure functions)
Little bit about our golden bullet - re-frame
re-frame is a ClojureScript framework for building user interfaces. It has a data-oriented, functional design. Its primary focus is on high programmer productivity and scaling up to larger Single-Page applications.
It has 3 most important parts
- Application state - in one place (one object)
- Events - pure functions which may modify the state
- subscriptions and views
it would be great if we could move the application state in C++ and move and keep events pure in status-go
so it could be like this
let’s say if an user makes an action in the UI, we call a method in status-go and it changes the application state in C++ and both mobile and desktop reacts to these changes and update UI
in that case, business logic stays pure, and UI layers are separated so they are not directly connected but reacts to the app state changes
WDYT? Let me know in the comments
UPDATE: there is also a side question for discussion, do we really want to use golang? it can be c++ or nim or …? currently golang is historically used because of go-ethereum