Difference between revisions of "Help:Analytica conventions in open assessment"

From Testiwiki
Jump to: navigation, search
(first draft)
 
(Conventions for coding: some updates)
Line 10: Line 10:
 
==Conventions for coding==
 
==Conventions for coding==
  
* Usually lengthy descriptive names for local variables just reduce the readability of the code. Avoid them.
 
* Local variables are named starting with a, b, c, and so on. Usually local variable a is something that transforms in the code to become the final result.
 
* If you don't need a new local variable, use the existing one.
 
* Local indices use i, j, k, and so on.
 
* While-do loops use x, y, z as local loop variables.
 
 
* If you must choose between several intermediate nodes with no clear interpretation, or one node with a lengthy code, go for one node.
 
* If you must choose between several intermediate nodes with no clear interpretation, or one node with a lengthy code, go for one node.
 
* Try to separate input parameters and the actual code into different nodes. Usually input parameters can be pink data-driven nodes.
 
* Try to separate input parameters and the actual code into different nodes. Usually input parameters can be pink data-driven nodes.
Line 25: Line 20:
 
** make a link to the wiki page by using: <nowiki><a href="URL_of_the_page">Variable description in wiki</a></nowiki>
 
** make a link to the wiki page by using: <nowiki><a href="URL_of_the_page">Variable description in wiki</a></nowiki>
 
** change the name of the variable into the var_name of the variable, e.g. H1998.
 
** change the name of the variable into the var_name of the variable, e.g. H1998.
 +
* Index names should be in singular (e.g. '''Emission''', which is a list of different kinds of emissions), while variables are often intuitive being plural (e.g. '''Emissions''', which is the amount of emissions, indexed by '''Emission''').
 +
* If your local variable can have a clear and short descriptive name, use it. However, often the variables are complex objects that do not have obvious names; then it is better to use just letters.
 +
** If a local index shows in the final output, it should have a clear descriptive name.
 +
** Local variables are named starting with a, b, c, and so on. Usually local variable a is something that transforms in the code to become the final result.
 +
** If you don't need a new local variable, use the existing one.
 +
** Local indices use i, j, k, and so on.
 +
** While-do loops use x, y, z as local loop variables.
 +
 +
==See also==
 +
 +
* [[:en:Programming style|Programming style]] guidance in Wikipedia.

Revision as of 09:54, 22 September 2008

Analytica conventions in open assessment describe practices that have been found useful when using Analytica, or extended causal diagrams produced with other software.

Conventions for diagrams

Follow the node types and colours described in Help for enhanced causal diagrams.ANA

Error creating thumbnail: Unable to save thumbnail to destination

Conventions for coding

  • If you must choose between several intermediate nodes with no clear interpretation, or one node with a lengthy code, go for one node.
  • Try to separate input parameters and the actual code into different nodes. Usually input parameters can be pink data-driven nodes.
  • Locate the nodes so that all arrows are shown. An exception to this rule is a situation where one node uses a large number of similar nodes as input; then the input nodes are located in row so that only one arrow is visible.
  • Avoid descriptions {inside brackets} in the code, because it makes it difficult to temporarily move parts of the code out by using { }.
  • Instead, divide the code into sections using empty lines between the sections. Then number and describe each section in the Description field.
  • Do not add user-defined attributes to the model.
  • If the node is an open assessment variable (i.e., it has a wiki page), do the following:
    • bevel the node
    • make a link to the wiki page by using: <a href="URL_of_the_page">Variable description in wiki</a>
    • change the name of the variable into the var_name of the variable, e.g. H1998.
  • Index names should be in singular (e.g. Emission, which is a list of different kinds of emissions), while variables are often intuitive being plural (e.g. Emissions, which is the amount of emissions, indexed by Emission).
  • If your local variable can have a clear and short descriptive name, use it. However, often the variables are complex objects that do not have obvious names; then it is better to use just letters.
    • If a local index shows in the final output, it should have a clear descriptive name.
    • Local variables are named starting with a, b, c, and so on. Usually local variable a is something that transforms in the code to become the final result.
    • If you don't need a new local variable, use the existing one.
    • Local indices use i, j, k, and so on.
    • While-do loops use x, y, z as local loop variables.

See also