Understanding App Inventor Code Conventions

Coding Conventions in App Inventor

Coding conventions are an important part of programming, they ensure that code is consistent from developer to developer, they are essentially the rules of programming and although they are not always enforced by compilers, if you publish an extension that doesn't follow the coding conventions you'll likely receive a comment here or there telling you to update your extension so that it is inline with established standards and best practices.

The following are some of the common coding conventions used across the App Inventor platform, note that some of these conventions are different from javas coding conventions.

  • Lists start at index 1, if you are making an extension that uses arrays be sure to subtract the provided index by 1, e.g. index 1 will become 0 (start of array)
  • Methods always use UpperCamelCase
  • Classes always use UpperCamelCase
  • Parameters always use lowerCamelCase
  • When setting the version of your extension your version must be a whole number, you cannot create an extension of version 2.5 for example.
Take for example the following code block;

You will notice that the Name of the method is in UpperCamelCase and that the parameters are all in lowerCamerCase this is standard across App Inventor and App Inventor extensions.

Now have a go at the following knowlegde check:

Was this helpful?

Yes No

Thunkable Components