Skip to main content

4.11) Legible Code


One of the most important things when programming in general is making your code legible. This is much more important to people (most of all to yourself) than to the software (as long as the syntax is correct). The following four points will help you write clear, comprehensive and communicable code.

  1. Comment, comment, comment (anything in a line after a semicolon is a comment in NetLogo)
    • Variable declaration – purpose and range
    • Procedure – purpose and description
    • Sub-model equations – cite, explain
  2. Indent the code so that it shows clear code blocks
  3. Once done, take time to provide detailed documentation of your model. This is often neglected once one has a running model.
  4. Working in groups forces you to present code to other people and thinking through the code of other people.