How to make mobile app more performant and reduce development costs for both mobile and desktop

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 :slight_smile:

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

  1. Application state - in one place (one object)
  2. Events - pure functions which may modify the state
  3. 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 :slight_smile:

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

7 Likes

I would like to make an alternate client for Waku/Status in Flutter. I think just like Matrix and it’s ecosystem, the Waku network needs client diversity for further decentralization.
What do you think?

2 Likes

Btw: I don’t say this as if I wanted to compete with Status. I’d like to join your team someday, but currently I’m busy with my own projects and things. This Flutter client would exist under the same license as Status for those who want to tinker with the Waku network, but I wouldn’t release it to app stores.

switch to c++ or nim and rewrite it again? i’m against it seriously. program language is just a tool, once we decide on a language, we need to make good use of it, not change it and change it, life is short.

  • java is the best program language
  • php is the best language
  • c++ is …
    stop the war pls. language is not a big deal, the person is, we can see the problem from this discussion re-distribution-of-ens-token
1 Like

Amazing short and clear explanation on Status im architecture. I think this will pave the way to many contribute even more with Status and/or build theirs on dapps based on this knowledge. Thanks for sharing!

1 Like