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

Comments

  1. Where is the rest of the lessons?

    ReplyDelete
    Replies
    1. I endeavour to continue this series and provide an easy to follow resource on developing your own extensions, I have been managing with an overuse injury though so this may take time, I thank you for your patience.

      Feel free to follow my blog for updates or subscribe to the RSS feed for my blog to get notified of new posts :)

      Delete
    2. Unfortunately I haven't developed any new guides yet but I'm still around and have launched some updates to my extensions, so hopefully I can start creating more content this year :)

      Feel free to subscribe by email on the left hand menu to get email updates when I post new articles!

      Delete
    3. Sorry I just read your original message again, have you seen all the other existing lessons?

      you can find them all here: https://thunkableblocks.blogspot.com/2017/08/create-your-own-extensions-in-app.html

      Delete
  2. Thanks Luke for the very good lessons. Would you please give a simple example of using the devovolpment invironment to create an app inventor extension?

    ReplyDelete

Post a Comment

Thunkable Components