Touch Develop retirement postponed until June 22, 2019. Sign-in and access to cloud assets to be removed on May 23, 2018.Learn More..


coding guidelines

This is a set of recommended guidelines when authoring code or libraries. Feel free to diverge if you think we are wrong!

conventions

actions

Lower case with spaces as necessary.
  • good: action do stuff
  • not so good: action doStuff, avoid camel notation
  • not so good: action DoStuff, avoid capitalized notation
  • not so good: action do_stuff, avoid underscore, use space instead

action parameters

Use meaningful self documenting names rather than initials.
  • good: action do stuff(height : Number)
  • not so good: action do stuff(h : Number)

documentation

actions

  • The description of an action is added by writing a comment on the first line. The description is displayed in various places to the user.
function
mysterious
()
Print a random number on the screen.
...
end function

libraries

  • actions named example... will be considered documentation in libraries.
  • comments support a Wiki syntax (subset of markdown).
  • use your own logger instance to provide categorized logging messages
 logger := app → create logger("my lib")
 logger → debug("a debug message from my lib")