Tip: Keep an independent variable map

When we develop we have a tendency to name strings something which will make them recognizable - such as “isUserLogged” or “username,” however, when building a large application, in the end this practice contributes to the size of the app significantly.

The best practice:

Create a separate document where you give each string and variable a recognizable name as an identifier, and an actual name for use in the app. Keep the strings limited to one letter or at the most one letter and one number.

Also, make a column so you can note each activity and flow function where the variable is used, so you can reference it for debugging purposes.

If you ever look at a well written sdk, you will see this is what they do.

I recently went through an entire app and did this. In the end, an app with a 34 MB download size was reduced to 5.8 MB.

I had a lot of variables.

1 Like

Thanks for the tip but I really don’t get how reducing the name and property names of variables helps to reduce the size of an app significantly. It’s just text. Or did I misunderstood something?

However, does it make sense to group some of the variables as objects to reduce size, like here for example?

Yes absolutely. And also use placeholders so the same variable can be applied to different use cases.

Everything in an app is reduced to bytes. Everything is, in the end, text. Take a look at the actual code for SDKs and look at the variables. It’s all a, b, c, d, 1,2,3