I have a simple app in development, however, already published on the Play Store for general use. But I am having a big problem with block quantities. I haven’t even reached half of the App yet, and I already have 1990 blocks.
So, the reason for my post is that I would like to receive tips from you professionals, remembering that I am just a beginner, and reading a lot to learn more and more.
So, what should I do to make it more compact? Is there an extension to help with this?
1- Don’t add a lot of blocks to set every component property, make some methods, store data in database, use a loop instead.
2- Use dynamic components instead of the normal static components: [F/OS] - Dynamic Components Extension (for every component) 2.0
No panic! I think this is normal as beginner. At the moment I’m working on a project, what I started again for the third time.
First try: 20,000 blocks
Second try: 14,000 blocks
Now: 5,000 blocks at the moment (but I think I won’t need more than 10,000 blocks this time and I will have much more functionality than in the first and second try)
What I want to say is:
1990 blocks are not necessarily a lot
What I learned during these three tries is:
first make a plan of everthing you want in your app and then start programming
using many procedures
working with lists, working with lists and working with lists
the “split text … at …”-block is for the last point very helpfully
One thing I do to reduce blocks and simplify my code is this: Every time some code or group of blocks repeats, you make it a procedure and you replace that group of blocks with a call to that procedure. Even if it is for different components.
Example: If you need to delete many text boxes except one, you make a procedure that takes one text box as input (the one you want to keep) and set the others to " ". You need to use the Any Component blocks a lot. Also the generic events blocks helps a lot in reducing the blocks amount.