Tips and good development practices

I believe most of us here on the forum are laymen or beginners in programming. It would help a lot a post with tips and good development practices. Thank you!

You might start with these Carlos

Inventor's Manual



  • Start a Google Doc with a Table of Contents explaining your app, with sections for Design, Data, Code, including Downloaded Png images of all Events, Procedures, Globals, and with html cross-links for easy navigation. Such a doc becomes easier to read than a complete blocks image, because you have FIND, Next, PREV, back functionality, and you can add paragraphs of commentary around your code. This is my preferred life saver when doing a very large complex app. If you go this route, try to arrange your blocks geographically in a column matching the order of your Table of Contents, then do periodic Clean Up Blocks to pull them inline. This sometimes lowers the load on the Blocks Editor.
  • Reduce your block count:
    • Use parametrized procedures for common code
    • Use Media text files instead of big clumps of text blocks
    • Use generic blocks instead of repeating component event blocks
    • Encode repeating decision patterns into lookup tables loaded from Media csv text files (does your blocks image look like a box of combs?)
  • Name Everything, including purpose and type, like
    • btnQuit (the button that asks to quit)
    • lblUserID (the Label with the User ID)
    • Reset (the Procedure to reset everything)
    • QuestionsList (The list of questions)
  • How to read your code:
    • Trace the value of each variable backwards, to insure it is being used the same way each place:
      • same type (number/text/list) in global init
      • same type in returned TinyDB default (0/blank/create empty list)
    • Make sure data is processed in the proper event. Don't expect it immediately if it comes from online/gps/database
  • Avoid side effect in procedures. Instead, use value procedures to return new data values from other value procedures.
  • It's always wise to parametrize
  • If in doubt, rip it out

See Enis' recommendations at MIT App Inventor 2 Tips – TWO DOG APPS